Using HasManyThrough with a Pivot Table in Laravel

1 episode 5 mins

Overview

How do we set up a HasManyThrough relationship through a pivot table in Laravel?

While it’s not immediately obvious, it’s still possible by using a pivot model and referencing the right columns!

In this snippet, we’ll look at an example of accessing all projects through all teams that the user belongs to.

Alex Garrett-Smith
Alex Garrett-Smith
Hey, I'm the founder of Codecourse!

Episodes

0%
Your progress
  • Total: 5m
  • Played: 0m
  • Remaining: 5m