• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Providers\AuthServiceProvider类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Illuminate\Foundation\Support\Providers\AuthServiceProvider的典型用法代码示例。如果您正苦于以下问题:PHP AuthServiceProvider类的具体用法?PHP AuthServiceProvider怎么用?PHP AuthServiceProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了AuthServiceProvider类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 == "[email protected]";
     });
 }
开发者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


示例16: boot

 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     parent::registerPolicies($gate);
     // Is Super Admin
     $gate->define('admin', function ($user) {
         return 1 == $user->role;
     });
 }
开发者ID:khanhpnk,项目名称:sbds,代码行数:14,代码来源:AuthServiceProvider.php


示例17: boot

 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     parent::registerPolicies($gate);
     // Show only for Admins
     $gate->define('show-admin', function ($user) {
         return $user->roles[0]->slug == 'admin';
     });
 }
开发者ID:dericcain,项目名称:OrgHealthTC,代码行数:14,代码来源:AuthServiceProvider.php


示例18: boot

 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     parent::registerPolicies($gate);
     // Add custom guard to application
     Auth::extend('eloquent', function ($app) {
         return new AppGuard(new EloquentUserProvider($this->app['hash'], $this->app['config']['auth.model']), $app->make('session.store'));
     });
 }
开发者ID:superpanda19,项目名称:laravel-angularjs-todo,代码行数:14,代码来源:AuthServiceProvider.php


示例19: boot

 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     parent::registerPolicies($gate);
     // Dynamically register permissions with Laravel's Gate.
     if (get_sparkplug_config('ACL')) {
         $this->registerGatePermissions($gate);
     }
 }
开发者ID:karthik1407s,项目名称:sparkplug,代码行数:14,代码来源:AuthServiceProvider.php


示例20: boot

 /**
  * Register any application authentication / authorization services.
  *
  * @param \Illuminate\Contracts\Auth\Access\Gate $gate
  *
  * @return void
  */
 public function boot(GateContract $gate)
 {
     parent::registerPolicies($gate);
     foreach (self::$rights as $right) {
         $gate->define($right, function ($user) use($right) {
             return in_array($right, $user->rights);
         });
     }
 }
开发者ID:scriptotek,项目名称:ub-baser,代码行数:16,代码来源:AuthServiceProvider.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Providers\EventServiceProvider类代码示例发布时间:2022-05-23
下一篇:
PHP Middleware\VerifyCsrfToken类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap