当前位置: 首页>>代码示例>>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;未经允许,请勿转载。