當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。