当前位置: 首页>>代码示例>>PHP>>正文


PHP Auth::extend方法代码示例

本文整理汇总了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);
     });
 }
开发者ID:drawmyattention,项目名称:expauth,代码行数:7,代码来源:ExpressionEngineUserServiceProvider.php

示例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);
 }
开发者ID:sdh100shaun,项目名称:gatekeeper,代码行数:12,代码来源:AuthServiceProvider.php

示例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();
     });
 }
开发者ID:dunksjunk,项目名称:ad-auth,代码行数:12,代码来源:ADAuthServiceProvider.php

示例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']);
     });
 }
开发者ID:hoangnd25,项目名称:laravel-boilerplate,代码行数:13,代码来源:AuthServiceProvider.php

示例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;
     });
 }
开发者ID:iget-master,项目名称:token-auth,代码行数:13,代码来源:TokenAuthServiceProvider.php

示例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();
 }
开发者ID:wisoot,项目名称:jwt-guard,代码行数:11,代码来源:JwtGuardServiceProvider.php

示例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']);
     });
 }
开发者ID:ckylape,项目名称:oauth-with-db,代码行数:13,代码来源:OAuthWithDatabaseServiceProvider.php

示例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']);
     });
 }
开发者ID:strebl,项目名称:Adldap2-laravel,代码行数:14,代码来源:AdldapAuthServiceProvider.php

示例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');
     });
 }
开发者ID:sonoftheweb,项目名称:laravel-angular-cms,代码行数:16,代码来源:MultiAuthServiceProvider.php

示例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']);
     });
 }
开发者ID:NogaevPN,项目名称:Adldap2-Laravel,代码行数:16,代码来源:AdldapAuthServiceProvider.php

示例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';
     }
 }
开发者ID:iget-master,项目名称:api-base,代码行数:17,代码来源:ApiBaseServiceProvider.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')]);
 }
开发者ID:gitllermopalafox,项目名称:user,代码行数:13,代码来源:UsersServiceProvider.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']);
 }
开发者ID:barnetik,项目名称:doctrine-auth-provider,代码行数:14,代码来源:DoctrineAuthServiceProvider.php

示例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');
     });
 }
开发者ID:autocar,项目名称:contactable,代码行数:23,代码来源:ContactableServiceProvider.php


注:本文中的Illuminate\Support\Facades\Auth::extend方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。