Monday, April 3, 2017

[ANSWERED]Eloquent relataionship 3 tables

im new to Stack Overflow and Laravel.
I try to develop an variable profilesystem in laravel and i got 3 tables (User,UserFields,Fields).
The strutucre of the fields table shows like this:
The structure of the user_fields table shows like this:
The user table is the standard table witch came with laravel 5
now i want to get all fields with user_fields depending on witch user is selected or logged in. If the user_field doesnt exists the model should return null or create a new record for the user_fields.
I try a lot of "solutions" witch came with eloquent like (hasManyThrough, belongsToMany) but i dont get the result witch i wanted.
Is there any solution with relationship methods?
Thanks for ur help, and sorry for my bad english :/


via Florian Beck-Klaus

Advertisement