Accessing distant relationships in laravel
Another really interesting Eloquent feature is the possibility to define (and then access) a distant relation, using the hasManyThrough() method.
What? I see you are a little confused. No problem: let’s take another example, which is a little different from our actual context.
Imagine that you are writing an application for some kind of research management for a research team. In this software, every user will be able to create a new research entity, and then add some sections to that research something like this:
A User entity that has a one-to-many relationship with a Research entity
The Research entity has a one-to-many relationship with a Section entity
Link:
This post is submitted by our members. Submit a new post.
Tags: Tutorials Laravel 5 Laravel 5.1