jeudi 19 mai 2016

Setting up Eloquent relationships, do I need to employ other relationship types?

i'm needing some help with setting up the proper relationships for my project.

The best way I can compare it is by considering a student timetable.

I need a user to be able to have many classes, and tasks within each of those classes. However, these tasks should also be linked to the user directly. I want to be able to call $user->tasks() and get all the tasks, rather than going through each $user->period.... The user has many periods, each period has many tasks, but the tasks should belong to user directly.

Any suggestions? Would i need to employ polymorphic relations in my table structure?

Thanks in advance.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1TK6RGp
via IFTTT

Aucun commentaire:

Enregistrer un commentaire