php Illuminate-Foundation-Support-Providers-AuthServiceProvider类(方法)实例源码

下面列出了php Illuminate-Foundation-Support-Providers-AuthServiceProvider 类(方法)源码代码实例,从而了解它的用法。

作者:udibaga    项目:sidi   
/**
  * 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;
     // });
 }

作者:kaungso    项目:ecomprojec   
/**
  * 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();
     });
 }

作者:aroguli    项目:laravel_tutoria   
/**
  * 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());
     });
 }

作者:LarryStanle    项目:ark-la   
/**
  * 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';
     });
 }

作者:wisle    项目:berrie   
/**
  * 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;
     });
 }

作者:abraaodw    项目:DFDia   
/**
  * 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;
     });
 }

作者:catchup-fork    项目:gamesho   
/**
  * 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;
     });
 }

作者:RichardMarbac    项目:mkdi   
/**
  * 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();
     });
 }

作者:VictorAvela    项目:sem   
/**
  * 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;
     });
 }

作者:juan2ramo    项目:agroselle   
/**
  * 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";
     });
 }

作者:wellbornma    项目:laravel-de   
/**
  * 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;
     });
 }

作者:MUS3RP0    项目:Plataforma-Virtua   
/**
  * 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;
     });
 }

作者:politicianmemetea    项目:scrubtitle   
/**
  * 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;
     });
 }

作者:atarge    项目:starte   
/**
  * 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;
     });
     //
 }

作者:andela-iadeniy    项目:youlear   
/**
  * 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;
     });
 }

作者:khanhpn    项目:sbd   
/**
  * 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;
     });
 }

作者:dericcai    项目:OrgHealthT   
/**
  * 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';
     });
 }

作者:superpanda1    项目:laravel-angularjs-tod   
/**
  * 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'));
     });
 }

作者:karthik1407    项目:sparkplu   
/**
  * 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);
     }
 }

作者:scriptote    项目:ub-base   
/**
  * 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);
         });
     }
 }


问题


面经


文章

微信
公众号

扫码关注公众号