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


PHP Permission::All方法代碼示例

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


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

示例1: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $variables = Variable::All();
     $permissions = Permission::All();
     return view('variables.index')->withVariables($variables)->withPermissions($permissions);
 }
開發者ID:reportingsjr,項目名稱:makerspace-manager,代碼行數:11,代碼來源:VariableController.php

示例2: getIndex

 public function getIndex()
 {
     $users = User::All();
     $permissions = Permission::All();
     return view('admin.index')->withUsers($users)->withPermissions($permissions);
 }
開發者ID:reportingsjr,項目名稱:makerspace-manager,代碼行數:6,代碼來源:AdminController.php

示例3: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function edit($type)
 {
     $permissions = Permission::All();
     return view('transtype.edit')->withType($type)->withPermissions($permissions);
 }
開發者ID:reportingsjr,項目名稱:makerspace-manager,代碼行數:11,代碼來源:TransactionTypeController.php

示例4: grantPermission

 /**
  * Grant a permission to a user
  */
 public function grantPermission(Request $request)
 {
     $user = User::find($request->get('user_id'));
     if ($request->get('permission_id') == 'all') {
         $permissions = Permission::All();
         foreach ($permissions as $permission) {
             if (!$user->permissions->contains($permission->id)) {
                 $user->permissions()->attach($permission);
                 if ($request->get('is_master')) {
                     $target = $user->permissions()->find($permission->id);
                     $target->pivot->is_master = true;
                     $target->pivot->save();
                 }
             }
         }
         Flash::success('Gave ' . $user->name . ' all permissions.');
         return redirect()->back();
     }
     $permission = Permission::find($request->get('permission_id'));
     $user->permissions()->attach($permission);
     if ($request->get('is_master')) {
         $target = $user->permissions()->find($permission->id);
         $target->pivot->is_master = true;
         $target->pivot->save();
     }
     Flash::success('Gave ' . $user->name . ' permission:' . $permission->name);
     return redirect()->back();
 }
開發者ID:reportingsjr,項目名稱:makerspace-manager,代碼行數:31,代碼來源:PermissionController.php


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