Skip to content

Commit

Permalink
check if resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Apr 17, 2019
1 parent 4a25686 commit be89773
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/Illuminate/Auth/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@ class AuthServiceProvider extends ServiceProvider
public function register()
{
$this->registerAuthenticator();

$this->registerUserResolver();

$this->registerAccessGate();

$this->registerRequestRebindHandler();

$this->registerEventRebindHandler();
}

Expand Down Expand Up @@ -77,7 +73,7 @@ protected function registerAccessGate()
}

/**
* Register a resolver for the authenticated user.
* Handle the re-binding of the request binding.
*
* @return void
*/
Expand All @@ -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);
}
});
Expand Down

0 comments on commit be89773

Please sign in to comment.