samedi 25 mars 2017

Laravel 5.3 multiple auth login fatal error

I previously use this example with another application give true response but when I try

Auth::guard("seller")->attempt( ["email" => $data["email"], "password" => $data["password"] ])

it would not worked at all.

I could not get the reason why this error is thrown this time. Any one please guide me the explanation why this error occur.

I registered the guard config in Config/Auth.php as below:

'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'users',
        ],

        'seller' => [
            'driver' => 'session',
            'provider' => 'sellers',
        ],

        'api' => [
            'driver' => 'token',
            'provider' => 'users',
        ],
    ],
'providers' => [
        'users' => [
            'driver' => 'eloquent',
            'model' => App\User::class,
        ],
        'sellers' => [
            'driver' => 'eloquent',
            'model' => App\Seller::class,
        ],

        // 'users' => [
        //     'driver' => 'database',
        //     'table' => 'users',
        // ],
    ],

Log Status

FatalThrowableError in EloquentUserProvider.php line 114:
Type error: Argument 1 passed to Illuminate\Auth\EloquentUserProvider::validateCredentials() must be an 
instance of Illuminate\Contracts\Auth\Authenticatable, instance of 
App\Seller given, called in 
/Users/jainhub/Sites/dthsolutions/vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php on line 385

Stack Trace:

in EloquentUserProvider.php line 114
at EloquentUserProvider->validateCredentials(object(Seller), array('email' => 'anurag@dth.solutions', 'password' => '122')) in SessionGuard.php line 385
at SessionGuard->hasValidCredentials(object(Seller), array('email' => 'anurag@dth.solutions', 'password' => '122')) in SessionGuard.php line 358
at SessionGuard->attempt(array('email' => 'anurag@dth.solutions', 'password' => '122')) in AuthController.php line 41
at AuthController->login(object(Request))
at call_user_func_array(array(object(AuthController), 'login'), array(object(Request))) in Controller.php line 55
at Controller->callAction('login', array(object(Request))) in ControllerDispatcher.php line 44
......
......
........



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2n1sjhe
via IFTTT

Aucun commentaire:

Enregistrer un commentaire