php - Authenticate A User Instance not working Laravel 5.0 -
i try authenticate user nothing happens in controller
i next
$authuser = user::where('password', md5($user->salt . $request->get('password'))) ->where('email', $request->get('email')) ->first(['login', 'email', 'firstname', 'lastname', 'zip_code','phone']); if ($authuser) { auth::login($authuser); return response()->json(['user' => $authuser]); }
response returns me user next request error user not authenticated. idea?
hello it's happens because forgot add id field array of returned fields, try add like
$authuser = user::where('password', md5($user->salt . $request->get('password'))) ->where('email', $request->get('email')) ->first(['id', 'login', 'email', 'firstname', 'lastname', 'zip_code','phone']); if ($authuser) { auth::login($authuser); return response()->json(['user' => $authuser]); }
Comments
Post a Comment