I have stored procedure that accepts login and password, and gives or status or user id. I extended LoginController for working with this. This is working until I'll input correct data. After execution of procedure I'm trying to authorize user via id but it's wrong (and User model doesn't exists).
public function login(Request $request)
{
$this->validateLogin($request);
if (method_exists($this, 'hasTooManyLoginAttempts') &&
$this->hasTooManyLoginAttempts($request)) {
$this->fireLockoutEvent($request);
return $this->sendLockoutResponse($request);
}
$result = DB::select(DB::raw("SET NOCOUNT ON {CALL users.Login (@Login =:username, @Password =:password)}"),[
':username' => $request->login,
':password' => $request->password,
]);
switch($result[0]->status){
case '-3':
$message = "Login is banned";
break;
case '-2':
$message = 'Wrong password';
break;
case '-1':
$message = 'You are haven\'t rights';
break;
}
if ($result[0]->status > 0) {
//Auth::loginUsingId($result[0]->status);
return $this->sendLoginResponse($request);
}
$this->incrementLoginAttempts($request);
return $this->sendFailedLoginResponse($request, $message);
}
I'm accepting this error:
Symfony\Component\Debug\Exception\FatalThrowableError Class
'\App\Models\User' not found
How to write user data to session and use it via Auth facade?
P.S I now that exists this question but no answer here...