samedi 25 août 2018

How to create relationship in Laravel 5 which will collect records of own model mentioned in pivot table?

I have 3 tables users, companies and pivot table with user_id, company_id. I can't get users, which belongs to my company inside User model. Tried like

belongsToMany('App\User','companies_users','company_id','user_id' );

but I get relation with wrong users.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2BMo719
via IFTTT

Aucun commentaire:

Enregistrer un commentaire