I need help, don't see anything suspicious :c thanks for help !
Error Collection::addEagerConstraints does not exist occurs after the call:
public function show(Request $request, User $user)
{
$user->load('permissions');
dd($with);
return UserResource::make($user);
}
User Model:
class User extends Authenticatable
{
(...)
//////////////////////////////////////////////////////////////////////////////////////////
///
/// Relationships
///
//////////////////////////////////////////////////////////////////////////////////////////
/**
* Relationship to permissions
*
* @return RolePermissions
*/
public function permissions()
{
return $this->role()->first()->permissions;
}
}
permissions? Or ispermissionsjust a column inroles? - Tim Lewis->load()on a non-relationship, and unless Permission is a model (which I suspect it isn't), this code needs to be changed. - Tim Lewis