在Laravel中尝试在没有密码的情况下对用户进行身份验证

I am trying to implement the login without password in laravel application but it shows an error: Argument 1 passed to Illuminate\Auth\SessionGuard::login() must be an instance of Illuminate\Contracts\Auth\Authenticatable, string given And the code i am using is:

$checkUser = 'manish.arora4926@gmail.com';


    Auth::login($checkUser, true);

Please help me to resolve this issue.

If you need to log an existing user instance into your application, you may call the login method with the user instance. The given object must be an implementation of the Illuminate\Contracts\Auth\Authenticatable contract. Of course, the App\User model included with Laravel already implements this interface:

$checkUser must be eloquent instance. so you need to access eloquent before authenticate user

$checkUser=App\User::where('email','manish.arora4926@gmail.com')->first();
Auth::login($checkUser, true);

in case you know id of user just using login using id

Auth::loginUsingId(1);
// Login and "remember" the given user...
Auth::loginUsingId(1, true);

Considering your email column name is email, try

$user = User::whereEmail('manish.arora4926@gmail.com')->first();
Auth::login($user)

or

Auth::loginUsingId($user->id);