From be89773c52e7491de05dee053b18a38b177d6030 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 17 Apr 2019 09:02:33 -0500 Subject: [PATCH] check if resolved --- src/Illuminate/Auth/AuthServiceProvider.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Illuminate/Auth/AuthServiceProvider.php b/src/Illuminate/Auth/AuthServiceProvider.php index 93ed6c29c63f..dfc554b278b4 100755 --- a/src/Illuminate/Auth/AuthServiceProvider.php +++ b/src/Illuminate/Auth/AuthServiceProvider.php @@ -17,13 +17,9 @@ class AuthServiceProvider extends ServiceProvider public function register() { $this->registerAuthenticator(); - $this->registerUserResolver(); - $this->registerAccessGate(); - $this->registerRequestRebindHandler(); - $this->registerEventRebindHandler(); } @@ -77,7 +73,7 @@ protected function registerAccessGate() } /** - * Register a resolver for the authenticated user. + * Handle the re-binding of the request binding. * * @return void */ @@ -91,15 +87,18 @@ protected function registerRequestRebindHandler() } /** - * Register a resolver for the 'events' rebinding. + * Handle the re-binding of the event dispatcher binding. * * @return void */ protected function registerEventRebindHandler() { $this->app->rebinding('events', function ($app, $dispatcher) { - $guard = $app['auth']->guard(); - if (method_exists($guard, 'setDispatcher')) { + if (! $app->resolved('auth')) { + return; + } + + if (method_exists($guard = $app['auth']->guard(), 'setDispatcher')) { $guard->setDispatcher($dispatcher); } });