当前位置: 首页>>代码示例>>PHP>>正文


PHP Permission::lists方法代码示例

本文整理汇总了PHP中app\models\Permission::lists方法的典型用法代码示例。如果您正苦于以下问题:PHP Permission::lists方法的具体用法?PHP Permission::lists怎么用?PHP Permission::lists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Permission的用法示例。


在下文中一共展示了Permission::lists方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $role = \App\Models\Role::findOrFail($id);
     $this->authorize('update', $role);
     $list = \App\Models\Permission::lists('title', 'id');
     //        dd($role->permissions()->lists('id'));
     return view('roles.edit', ['pList' => $list, 'role' => $role]);
 }
开发者ID:jaffarhussain1011,项目名称:laravel-authorization-demo,代码行数:14,代码来源:RoleController.php

示例2: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $pIds = Permission::lists('id');
     //superadmin
     foreach ($pIds as $id) {
         DB::table('permission_role')->insert(['permission_id' => $id, 'role_id' => 1]);
     }
     //admin
     DB::table('permission_role')->insert([['permission_id' => 1, 'role_id' => 2], ['permission_id' => 2, 'role_id' => 2], ['permission_id' => 3, 'role_id' => 2], ['permission_id' => 4, 'role_id' => 2], ['permission_id' => 6, 'role_id' => 2], ['permission_id' => 11, 'role_id' => 2], ['permission_id' => 13, 'role_id' => 2], ['permission_id' => 16, 'role_id' => 2], ['permission_id' => 17, 'role_id' => 2], ['permission_id' => 18, 'role_id' => 2], ['permission_id' => 19, 'role_id' => 2], ['permission_id' => 21, 'role_id' => 2], ['permission_id' => 22, 'role_id' => 2], ['permission_id' => 23, 'role_id' => 2], ['permission_id' => 24, 'role_id' => 2], ['permission_id' => 26, 'role_id' => 2], ['permission_id' => 27, 'role_id' => 2], ['permission_id' => 28, 'role_id' => 2], ['permission_id' => 29, 'role_id' => 2], ['permission_id' => 30, 'role_id' => 2]]);
     //editor
     DB::table('permission_role')->insert([['permission_id' => 1, 'role_id' => 3], ['permission_id' => 3, 'role_id' => 3], ['permission_id' => 21, 'role_id' => 3], ['permission_id' => 23, 'role_id' => 3], ['permission_id' => 27, 'role_id' => 3], ['permission_id' => 29, 'role_id' => 3]]);
 }
开发者ID:jaumesala,项目名称:opendata-maps,代码行数:17,代码来源:PermissionRoleTableSeeder.php

示例3: run

 public function run()
 {
     // Attach permission to role
     //DB::table(Config::get('entrust.permission_role_table'))->forceDelete();
     DB::table(Config::get('entrust.permission_role_table'))->truncate();
     $role = Role::find(1);
     $role->perms()->attach(Permission::lists('id')->all());
     $role = Role::find(2);
     $role->perms()->attach(Permission::lists('id')->all());
     // Attach role to user
     //DB::table(Config::get('entrust.role_user_table'))->forceDelete();
     DB::table(Config::get('entrust.role_user_table'))->truncate();
     $user = User::find(1);
     $user->roles()->attach(Role::find(1));
 }
开发者ID:nuwira,项目名称:tunggorono,代码行数:15,代码来源:UserRolePermissionTableSeeder.php

示例4: addPermission

 /**
  * Add permissions to user to make them a concierge
  */
 public function addPermission($title)
 {
     $assigned_permissions = array();
     $permissions = Permission::lists('permission');
     switch ($title) {
         case 'admin':
             $assigned_permissions[] = $this->getIdInArray($permissions, 'view_lecturer');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'create_lecturer');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'edit_lecturer');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'delete_lecturer');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'view_user');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'create_user');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'edit_user');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'delete_user');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'view_student');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'create_student');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'edit_student');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'delete_student');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'view_university');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'create_university');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'edit_university');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'delete_university');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'view_sos_request');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'create_sos_request');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'edit_sos_request');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'delete_sos_request');
         case 'lecturer':
             $assigned_permissions[] = $this->getIdInArray($permissions, 'view_student');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'view_profile');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'edit_profile');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'view_sos_request');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'create_sos_request');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'delete_sos_request');
         case 'student':
             $assigned_permissions[] = $this->getIdInArray($permissions, 'view_profile');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'edit_profile');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'view_sos_request');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'create_sos_request');
             $assigned_permissions[] = $this->getIdInArray($permissions, 'delete_sos_request');
             break;
         default:
             throw new \Exception("The employee status entered does not exist");
     }
     $this->permissions()->attach($assigned_permissions);
 }
开发者ID:joaonzangoII,项目名称:find_my_campuses_friend,代码行数:48,代码来源:User.php

示例5: composerRoleForm

 private function composerRoleForm()
 {
     view()->composer('admin.roles.fields', function ($view) {
         $view->with('permissions', \App\Models\Permission::lists('name', 'id'));
     });
 }
开发者ID:jclyons52,项目名称:mycourse-rocks,代码行数:6,代码来源:ViewComposerServiceProvider.php


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