I want that every time I instantiate a User in my application from my UsersController, it comes with the relationships that it has created. I mead, for example a User belongsTo a Person and a User hasMany Form. This is the way I handle my object right now:
public function show( User $user ){
$user->person;
$user->forms;
return view( 'admin.show', compact( 'user' ) );
}
But I don't think, that is a correct way to do it. It would be nice if I could get rid of $user->person; and $user->forms;
How can I accomplish it?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire