I have three db tables:
attributes
---------------------------------
| id | name | showed_name | class
attributes_profiles
----------------------------------------------
| id | attribute_name | profile_id | content |
profiles
------------
| id | ... |
When a User go on the profile site, I want to load ALL Attributes from the table, but I also want the content from the intermediate table (pivot) for this user (id).
public function Attribute(){
return $this->belongstoMany('App\Attribute', 'attributes_profiles', 'profile_id', 'attribute_name','id','name')->withPivot('content');
}
With this class in the profiles model, I wouldn't be able to get all attributes.
When I use a Profiles() Class in the Attributes Model, I get every Attribute but not the content for the user... but for every user.