Thursday, October 5, 2017

Laravel : Argument 1 passed to Illuminate\Auth\Guard::login() must implement interface Illuminate\Contracts\Auth\Authenticatable, null given

This Error Happened when I tried to register a new user  using RegistersUsers  trait in :

App\Auth\RegisterController

Method : create

this method must return an instance of the created (registered) user from the mentioned method , which is by default return this instance as follow :

return User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
        ]);

look to the word return in the beginning .
if you manipulated the original code in this method and forgot to return an instance of the created user then Laravel will through this error..

No comments:

Post a Comment