0
In the following code, the following error occurs, which I cannot understand why:
Call to a Member Function Pluck() on null
public function edit($id)
{
$user = User::find($id);
$roles = Role::pluck('name','name')->all();
$userRole = $user->roles->pluck('name','id')->all();
return view('users.edit',compact('user','roles','userRole'));
}
Welcome Albino, this would help you: https://stackoverflow.com/questions/52800750/call-to-a-member-function-pluck-on-null?
– Luiz Augusto
on which line is the error?
– Jorge Costa