mercredi 11 octobre 2017

Laravel more than two Many-to-Many Relationship

following up on this thread Three-way many-to-many relationship in Laravel

I am trying to reproduce this example because I find this is a neat approach to implement a three way many-to-many relation via Eloquent.

But I am getting an error when I try to retrieve anything :

$user->relations()->where('student_id', $student)->first()->plan();

Tinker tells me that there should be a pivot table relation_user. If this is the case the solution won't be "neat" as appealing anymore. There have to be something I am missing, this thread doesn't show the migrations, is there a way to reproduce what Carlos Herrera Plata is saying on this thread ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire