當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。