first(); if (!$user){ throw ValidationException::withMessages([ "email" => "Email is not exists!" ]); } if (!Hash::check($params["password"],$user->password)){ throw ValidationException::withMessages([ "password" => "Password is wrong!" ]); } $token = $user->createToken($device); return [$user, $token]; } public function logout(){ auth()->user()->currentAccessToken()->delete(); } }