문제

I'm trying to extend auth provided by Laravel and stuck at EloquentUserProvider which requires HasherInterface in constructor. How i can create this object?

도움이 되었습니까?

해결책

The hasher is bound to the IoC container as hash, and can be resolved from the container using a couple of different methods. The method you use usually depends on where exactly you're extending the authentication layer.

To resolve the hasher from the container:

$hasher = App::make('hash');

$hasher = $app['hash'];

When extending auth the callback you supply should receive the application container as the first parameter. You can access the hasher using the second method described above.

Auth::extend('custom', function($app)
{
    $hasher = $app['hash'];

    return YourAuthProvider($hasher);
});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top