當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Permission::lists方法代碼示例

本文整理匯總了PHP中app\Permission::lists方法的典型用法代碼示例。如果您正苦於以下問題:PHP Permission::lists方法的具體用法?PHP Permission::lists怎麽用?PHP Permission::lists使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Permission的用法示例。


在下文中一共展示了Permission::lists方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  *
  * @return Response
  */
 public function edit($id)
 {
     $role = Role::findOrFail($id);
     $permission_role = Role::find($id)->permissions()->lists('permission_id')->toArray();
     $permissions = Permission::lists('display_name', 'id');
     return view('admin.roles.edit', compact('role', 'permissions', 'permission_role'));
 }
開發者ID:wilderguzman,項目名稱:lugrawibe,代碼行數:14,代碼來源:RolesController.php

示例2: ComposeWebPanelForms

 public function ComposeWebPanelForms()
 {
     view()->composer('templates.' . \Config::get('webpanel.template') . 'webpanel.store.items._form', function ($view) {
         $view->with('categories', StoreCategory::lists('display_name', 'id'));
         $view->with('servers', StoreServer::lists('display_name', 'id'));
     });
     view()->composer('templates.' . \Config::get('webpanel.template') . 'webpanel.store.categories._form', function ($view) {
         $view->with('servers', StoreServer::lists('display_name', 'id'));
     });
     view()->composer('templates.' . \Config::get('webpanel.template') . 'webpanel.panel.users._form', function ($view) {
         $view->with('roles', Role::lists('display_name', 'id'));
     });
     view()->composer('templates.' . \Config::get('webpanel.template') . 'webpanel.panel.roles._form', function ($view) {
         $view->with('permissions', Permission::lists('display_name', 'id'));
     });
     view()->composer('templates.' . \Config::get('webpanel.template') . 'webpanel.panel.permissions._form', function ($view) {
         $view->with('roles', Role::lists('display_name', 'id'));
     });
 }
開發者ID:brucewu16899,項目名稱:WebPanel-Core,代碼行數:19,代碼來源:ViewComposerServiceProvider.php

示例3: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     // Inserts the Permissions
     Permission::insert($this->permissions);
     // Creates a root admin role
     $rootadmin = new Role();
     $rootadmin->name = "rootadmin";
     $rootadmin->display_name = "Root Admin";
     $rootadmin->description = "Has Permissions to do everything in the WebPanel";
     $rootadmin->save();
     //Get all permissions
     $ids = Permission::lists('id')->all();
     //Sync them to the rootadmin
     $rootadmin->perms()->sync($ids);
     //Creates an admin user
     $admin = new User();
     $admin->name = 'admin';
     $admin->email = 'admin@admin.com';
     $admin->password = bcrypt('password');
     $admin->save();
     $admin->roles()->sync(array($rootadmin->id));
 }
開發者ID:brucewu16899,項目名稱:WebPanel-Core,代碼行數:27,代碼來源:2015_05_20_000000_webpanel_add_permissions_roles.php

示例4: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $title = $this->title;
     $module_name = $this->module_name;
     $module_name_singular = str_singular($this->module_name);
     $module_icon = $this->module_icon;
     $module_action = "Edit";
     ${$module_name_singular} = Role::findOrFail($id);
     $permissions = Permission::lists('name', 'id');
     return view("backend.{$module_name}.edit", compact('module_name', "{$module_name_singular}", 'module_icon', 'module_action', 'title', "permissions"));
 }
開發者ID:nasirkhan,項目名稱:laravel-5-starter,代碼行數:17,代碼來源:RolesController.php

示例5: create

 public function create()
 {
     $role = new Role();
     $relations = Permission::lists('name', 'id');
     return view('entrust.roles.create', compact('role', 'relations'));
 }
開發者ID:decalages,項目名稱:ct-base,代碼行數:6,代碼來源:RolesController.php

示例6: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit(Request $request, $id)
 {
     $user = User::where('id', $id)->first();
     if ($user && ($user->id == $request->user()->id || $request->user()->hasPermission('admin'))) {
         $permissions = Permission::lists('name', 'id');
         $user_permissions = $user->permissions()->getRelatedIds()->all();
         return view('users.edit')->with('user', $user)->with('permissions', $permissions)->with('user_permissions', $user_permissions);
     } else {
         return redirect('/home')->withErrors('You do not have sufficient permissions');
     }
 }
開發者ID:scrx,項目名稱:zt1,代碼行數:17,代碼來源:UsersController.php

示例7: lists

 public function lists($value, $key = '')
 {
     return \App\Permission::lists($value, $key);
 }
開發者ID:crow1796,項目名稱:technologyRIS,代碼行數:4,代碼來源:PermissionRepository.php

示例8: getPermissions

 protected function getPermissions()
 {
     return Permission::lists('label', 'id')->toArray();
 }
開發者ID:wyrover,項目名稱:backendl5,代碼行數:4,代碼來源:RoleForm.php

示例9: edit

 /**
  * Form for editing an existing role with the given id is shown with this method.
  *
  * @param $id
  * @return \Illuminate\View\View
  */
 public function edit($id)
 {
     $role = Role::find($id);
     $permissions = Permission::lists('name', 'id');
     return view('rbac-gui.roles.edit', compact('role', 'permissions'));
 }
開發者ID:JimiOhrid,項目名稱:shopStore,代碼行數:12,代碼來源:RolesController.php

示例10: create

 public function create()
 {
     $permission = new Permission();
     $relations = Permission::lists('name', 'id');
     return view('entrust.permissions.create', compact('permission', 'relations'));
 }
開發者ID:decalages,項目名稱:ct-base,代碼行數:6,代碼來源:PermissionsController.php


注:本文中的app\Permission::lists方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。