当前位置: 首页>>代码示例>>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;未经允许,请勿转载。