當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Providers\AuthServiceProvider類代碼示例

本文整理匯總了PHP中Illuminate\Foundation\Support\Providers\AuthServiceProvider的典型用法代碼示例。如果您正苦於以下問題:PHP AuthServiceProvider類的具體用法?PHP AuthServiceProvider怎麽用?PHP AuthServiceProvider使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了AuthServiceProvider類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: boot

 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     parent::registerPolicies($gate);
     // $gate->define('update-post', function ($user, $post) {
     //     return $user->id === $post->user_id;
     // });
 }
開發者ID:udibagas,項目名稱:sidik,代碼行數:13,代碼來源:AuthServiceProvider.php

示例2: boot

 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     parent::registerPolicies($gate);
     $gate->define('isadmin', function () {
         return Auth::user()->role == 1 && Auth::user();
     });
 }
開發者ID:kaungsoe,項目名稱:ecomproject,代碼行數:13,代碼來源:AuthServiceProvider.php

示例3: boot

 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     parent::registerPolicies($gate);
     view()->composer('partials.nav', function (View $view) {
         $view->with('user', Auth::user());
     });
 }
開發者ID:arogulin,項目名稱:laravel_tutorial,代碼行數:13,代碼來源:AuthServiceProvider.php

示例4: boot

 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     parent::registerPolicies($gate);
     $gate->define('admin', function ($user) {
         return $user->group == 'admin';
     });
 }
開發者ID:LarryStanley,項目名稱:ark-lab,代碼行數:13,代碼來源:AuthServiceProvider.php

示例5: boot

 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     parent::registerPolicies($gate);
     $gate->define('access-admin', function ($user) {
         return $user->role === 2 || $user->role === 1;
     });
 }
開發者ID:wislem,項目名稱:berrier,代碼行數:13,代碼來源:BerrierAuthServiceProvider.php

示例6: boot

 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     parent::registerPolicies($gate);
     $gate->define('update-post', function ($autor, $artigo) {
         return $autor->id_autor === $artigo->id_autor;
     });
 }
開發者ID:abraaodwd,項目名稱:DFDias,代碼行數:13,代碼來源:AuthServiceProvider.php

示例7: boot

 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     parent::registerPolicies($gate);
     $gate->define('show-order', function ($user, $order) {
         return $user->id == $order->user_id;
     });
 }
開發者ID:catchup-forks,項目名稱:gameshop,代碼行數:13,代碼來源:AuthServiceProvider.php

示例8: boot

 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     parent::registerPolicies($gate);
     $gate->define('update-user', function ($user, $recordId) {
         return $user->id == $recordId || $user->isAdmin();
     });
 }
開發者ID:RichardMarbach,項目名稱:mkdir,代碼行數:13,代碼來源:AuthServiceProvider.php

示例9: boot

 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     parent::registerPolicies($gate);
     $gate->define('moderate', function ($user) {
         return $user->admin === 1;
     });
 }
開發者ID:VictorAvelar,項目名稱:semt,代碼行數:13,代碼來源:AuthServiceProvider.php

示例10: boot

 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     parent::registerPolicies($gate);
     $gate->define('admin', function (User $user) {
         return $user->email == "juan2sramos@gmail.com";
     });
 }
開發者ID:juan2ramos,項目名稱:agroseller,代碼行數:13,代碼來源:AuthServiceProvider.php

示例11: boot

 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     parent::registerPolicies($gate);
     $gate->define('update-contact', function ($user, $contact) {
         return $user->id === $contact->user_id;
     });
 }
開發者ID:wellbornman,項目名稱:laravel-dev,代碼行數:13,代碼來源:AuthServiceProvider.php

示例12: boot

 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     parent::registerPolicies($gate);
     $gate->define('manage', function ($user) {
         return $user->role_id == 1;
     });
 }
開發者ID:MUS3RP0L,項目名稱:Plataforma-Virtual,代碼行數:13,代碼來源:AuthServiceProvider.php

示例13: boot

 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     parent::registerPolicies($gate);
     // Defined abilities
     # Super Admin
     $gate->define('super-admin', function ($user) {
         return $user->role === 'admin' || $user->role === 'super-admin';
     });
     # Tasks
     $gate->define('update-task', function ($user, $task) {
         return $user->id === $task->id_users;
     });
     $gate->define('delete-task', function ($user, $task) {
         $flag = $user->role === 'admin' || $user->id === $task->id_users ? true : false;
         return $flag;
     });
     $gate->define('delete-task-admin', function ($user, $task) {
         return $user->role === 'admin';
     });
     # Boards
     $gate->define('update-board', function ($user, $board) {
         $flag = $user->role === 'admin' || $user->id === $board->id_users ? true : false;
         return $flag;
     });
     $gate->define('delete-board', function ($user, $board) {
         $flag = $user->role === 'admin' || $user->id === $board->id_users ? true : false;
         return $flag;
     });
     $gate->define('delete-board-admin', function ($user, $board) {
         $flag = $user->role === 'admin' ? true : false;
         return $flag;
     });
 }
開發者ID:politicianmemeteam,項目名稱:scrubtitles,代碼行數:39,代碼來源:AuthServiceProvider.php

示例14: boot

 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     parent::registerPolicies($gate);
     $gate->define("admin", function (User $user) {
         return $user->roles()->getQuery()->where("name", "=", "admin")->count() > 0;
     });
     //
 }
開發者ID:atarget,項目名稱:starter,代碼行數:14,代碼來源:AuthServiceProvider.php

示例15: boot

 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     parent::registerPolicies($gate);
     //Only User can edit
     $gate->define('see-edit', function ($user, $video) {
         return $user->id === $video->user_id;
     });
 }
開發者ID:andela-iadeniyi,項目名稱:youlearn,代碼行數:14,代碼來源:AuthServiceProvider.php


注:本文中的Illuminate\Foundation\Support\Providers\AuthServiceProvider類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。