Laravel pivot: Get model from withPivot() Laravel pivot: Get model from withPivot() laravel laravel

Laravel pivot: Get model from withPivot()


The ideal way to do this is to have a Model specifically for your pivot table. There are alternatives whereby you can have relationships defined in models, using the field pivot_study_level_id, but that wouldn't work in every situation and would likely be more trouble than it's worth.

Just setup a model like Establishment\User and let that handle the relationships.