本文整理汇总了PHP中Illuminate\Support\Facades\Auth::extend方法的典型用法代码示例。如果您正苦于以下问题:PHP Auth::extend方法的具体用法?PHP Auth::extend怎么用?PHP Auth::extend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Auth
的用法示例。
在下文中一共展示了Auth::extend方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: boot
public function boot()
{
Auth::extend('ExpressionEngineAuth', function ($app) {
$model = $this->app['config']['auth.model'];
return new ExpressionEngineUserProvider($this->app['hash'], $model);
});
}
示例2: boot
/**
* Boot the provider, adding the "gatekeeper" type to the Auth handling
*
* @param Router $router Laravel router instance
*/
public function boot(Router $router)
{
Auth::extend('gatekeeper', function ($app) {
return new UserProvider();
});
parent::boot($router);
}
示例3: boot
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
$this->publishes([__DIR__ . '/config/adauth.php' => config_path('adauth.php')], 'config');
Auth::extend('ads', function () {
return new ADAuthUserProvider();
});
}
示例4: boot
/**
* Register any application authentication / authorization services.
*
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
* @return void
*/
public function boot(GateContract $gate)
{
$this->registerPolicies($gate);
Auth::extend('api_token', function ($app, $name, array $config) {
return new ApiTokenGuard(Auth::createUserProvider($config['provider']), $this->app['request']);
});
}
示例5: boot
/**
* Perform post-registration booting of services.
*
* @return void
*/
public function boot()
{
Auth::extend('iget-token', function ($app, $name, array $config) {
$guard = new TokenGuard(Auth::createUserProvider($config['provider']), $app['request']);
$app->refresh('request', $guard, 'setRequest');
return $guard;
});
}
示例6: boot
/**
* Boot the service provider.
*/
public function boot()
{
Auth::extend('jwt', function ($app, $name, array $config) {
return new JwtGuard($app['auth']->createUserProvider($config['provider']), $app[JwtService::class], $app['request']);
});
$this->publishConfig();
$this->publishMigration();
}
示例7: boot
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$this->package('ckylape/oauth-with-db');
Auth::extend('oauth-with-db', function ($app) {
$provider = new OAuthWithDatabaseUserProvider();
return new OAuthWithDatabaseGuard($provider, $app['session.store']);
});
}
示例8: boot
/**
* Bootstrap the application services.
*
* @param Repository $config
*/
public function boot(Repository $config)
{
$this->loadViewsFrom(__DIR__ . '/../views', 'ghi');
$this->publishes([__DIR__ . '/../views' => base_path('resources/views/vendor/ghi')]);
$model = $config->get('auth.model');
Auth::extend('ghi-intranet', function ($app) use($model) {
return new IntranetUserAuthProvider($model);
});
}
开发者ID:Grupo-Hermes-Infraestructura,项目名称:laravel-intranet-auth,代码行数:14,代码来源:IntranetAuthServiceProvider.php
示例9: boot
/**
* Run service provider boot operations.
*
* @return void
*/
public function boot()
{
$auth = __DIR__ . '/Config/auth.php';
$this->mergeConfigFrom($auth, 'adldap_auth');
$this->publishes([$auth => config_path('adldap_auth.php')], 'adldap');
Auth::extend('adldap', function ($app) {
return new AdldapAuthUserProvider($app['hash'], $app['config']['auth.model']);
});
}
示例10: register
/**
* Register any application services.
*
* @return void
*/
public function register()
{
Auth::extend('userEloquent', function ($app) {
// you can use Config::get() to retrieve the model class name from config file
$myProvider = new EloquentUserProvider($app['hash'], '\\App\\Models\\User');
return new Guard($myProvider, $app['session.store']);
});
$this->app->singleton('auth.driver_user', function ($app) {
return Auth::driver('userEloquent');
});
}
示例11: boot
/**
* Run service provider boot operations.
*
* @return void
*/
public function boot()
{
$auth = __DIR__ . '/Config/auth.php';
// Add publishable configuration.
$this->publishes([$auth => config_path('adldap_auth.php')], 'adldap');
$this->mergeConfigFrom($auth, 'adldap_auth');
// Extend Laravel authentication with Adldap driver.
Auth::extend('adldap', function ($app) {
return new AdldapAuthUserProvider($app['hash'], $app['config']['auth.model']);
});
}
示例12: boot
/**
* Perform post-registration booting of services.
*
* @return void
*/
public function boot(GateContract $gate)
{
$this->registerPolicies($gate);
Auth::extend('auth-token', function ($app, $name, array $config) {
return new TokenGuard(Auth::createUserProvider($config['provider']), $app['request']);
});
$this->publishes([__DIR__ . '/../config/api.php' => config_path('api.php')], 'config');
$this->publishes([__DIR__ . '/../database/migrations/' => database_path('migrations')], 'migrations');
if (!$this->app->routesAreCached()) {
require __DIR__ . '/Http/routes.php';
}
}
示例13: boot
public function boot()
{
// loading the routes from the routes file.
if (!$this->app->routesAreCached()) {
require __DIR__ . '/Http/routes.php';
}
Auth::extend('eloquent', function ($app) {
return new CustomEloquentUserProvider($app['hash'], $app['config']['auth.model']);
});
// define the path to views
$this->loadViewsFrom(__DIR__ . '/../views', 'users');
$this->publishes([__DIR__ . '/config/user.php' => config_path('user.php'), __DIR__ . '/../database/migrations/2015_07_16_200000_create_roles_table.php' => base_path('database/migrations/2015_07_16_000000_create_roles_table.php'), __DIR__ . '/../database/migrations/2015_07_16_100000_create_permissions_table.php' => base_path('database/migrations/2015_07_16_000000_create_permissions_table.php'), __DIR__ . '/../database/migrations/2015_07_16_400000_create_user_roles_table.php' => base_path('database/migrations/2015_07_16_000000_create_user_roles_table.php'), __DIR__ . '/../database/migrations/2015_07_16_300000_create_role_permissions_table.php' => base_path('database/migrations/2015_07_16_000000_create_user_permissions_table.php'), __DIR__ . '/../database/seeds/UsersTableSeeder.php' => base_path('database/seeds/UsersTableSeeder.php'), __DIR__ . '/../database/seeds/RolesTableSeeder.php' => base_path('database/seeds/RolesTableSeeder.php'), __DIR__ . '/../database/seeds/PermissionsTableSeeder.php' => base_path('database/seeds/PermissionsTableSeeder.php'), __DIR__ . '/../database/seeds/RolePermissionsTableSeeder.php' => base_path('database/seeds/RolePermissionsTableSeeder.php'), __DIR__ . '/../views/partials/menubar.blade.php' => base_path('resources/views/menubar.blade.php')]);
}
示例14: boot
public function boot()
{
if (\Config::get('doctrine')) {
$em = $this->app->make('Doctrine\\ORM\\EntityManager');
$driver = \Doctrine\ORM\Mapping\Driver\AnnotationDriver::create(__DIR__);
$driverChain = $em->getConfiguration()->getMetadataDriverImpl();
$driverChain->addDriver($driver, 'Barnetik\\DoctrineAuth');
}
Auth::extend('doctrine', function ($app) {
$provider = new DoctrineUserProvider($app->make('Doctrine\\ORM\\EntityManager'), config('auth.model'));
return new \Illuminate\Auth\Guard($provider, $app['session.store']);
});
$this->commands(['Barnetik\\DoctrineAuth\\Console\\Commands\\CreateUser', 'Barnetik\\DoctrineAuth\\Console\\Commands\\PublishUserModel']);
}
示例15: boot
/**
* Perform post-registration booting of services.
*
* @return void
*/
public function boot()
{
// Publish configuration
$this->publishes([__DIR__ . '/../../config/contactable.php' => config_path('contactable.php')], 'config');
// Publish migrations
$this->publishes([__DIR__ . '/../Migrations/' => database_path('migrations')], 'migrations');
// Load views
$this->loadViewsFrom(__DIR__ . '/../../resources/views/', 'contactable');
// Bind the authentication provider
app()->bind('ContactableAuthProvider', function () {
return new ContactableAuthProvider(app('hash'), config('auth.model', \App\User::class));
});
// Add authentication driver
Auth::extend('contactable', function ($app) {
// Return an instance of Illuminate\Contracts\Auth\UserProvider...
return $app->make('ContactableAuthProvider');
});
}