Oct 28, 2015
0
Level 1
LogicException Error
Part of one of my controllers for my users is utilized to update the user's profile. Everything works except whenever I try to update the password, which always throws the error Relationship method must return an object of type Illuminate\Database\Eloquent\Relations\Relation.
The code I am using is:
public function UsersUpdate($id, Request $request){
$user = User::find($id);
$newPassword = bcrypt($request->get['password']);
if(empty($newPassword)){
$user->update($request->except('password'));
} else {
$user->name = $request->get('name');
$user->email = $request->get('email');
$user->role = $request->get('role');
$user->password = $newPassword;
$user->save;
}
return redirect('portal/users');
}
Please or to participate in this conversation.