#Setup correct contract for Auth method return

2 messages · Page 1 of 1 (latest)

harsh tartan
#

Sort of. You not testing whether your app is actually using the custom provider. I would do this in stead.

protected function getProvider(): \App\Providers\Auth\EloquentUserProvider
{
    /** @var \App\Providers\Auth\EloquentUserProvider $provider */
    $provider = Auth::createUserProvider('users');
    
    return $provider;
}

When static analysis tools infer the wrong type, you can always use phpdoc like this to help them.

#

Not sure why the facade doesn't work here, but try this in stead:

$provider = app('auth')->createUserProvider('users');