Skip to content

Commit

Permalink
Refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
kalesh13 committed Aug 24, 2019
1 parent 724c6b8 commit 3274989
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/ZauthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ class ZauthServiceProvider extends ServiceProvider
{
public function boot()
{
if ($this->app->runningInConsole()) {
$this->commands(ZclientCommand::class);
$this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
}
// Register the authentication guard
Auth::extend('zauth', function ($app, $name, array $config) {
return new Zguard(
Auth::createUserProvider($config['provider']),
$app['request'],
$app['cookie']
);
});

// Register the package middlewares.
$router = $this->app['router'];

Expand All @@ -26,13 +31,11 @@ public function boot()
$router->aliasMiddleware('adminOrClient', \Zauth\Http\Middleware\AdminOrClient::class);
}

// Register the authentication guard
Auth::extend('zauth', function ($app, $name, array $config) {
return new Zguard(
Auth::createUserProvider($config['provider']),
$app['request'],
$app['cookie']
);
});
// Register package commands and database migrations
if ($this->app->runningInConsole()) {
$this->commands(ZclientCommand::class);
$this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
}
}

}

0 comments on commit 3274989

Please sign in to comment.