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


PHP Permission::all方法代码示例

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


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

示例1: getCreate

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function getCreate(Request $request)
 {
     // Get all the available permissions
     $permissions = $this->permission->all();
     // Selected permissions
     $selectedPermissions = $request->old('permissions', array());
     // Title
     $title = 'Create role';
     // Show the page
     return view('core.admin.roles.create', compact('permissions', 'selectedPermissions', 'title'));
 }
开发者ID:fetch404,项目名称:fetch404,代码行数:16,代码来源:AdminRolesController.php

示例2: canRefence

 /**
  * Checking if the given user can reference the given uri.
  *
  * @param $user
  * @param $uri
  * @return bool
  */
 public function canRefence($user, $uri)
 {
     $permissions = $this->permission->all();
     foreach ($permissions as $permission) {
         if ($user->can($permission->name)) {
             $routes = $this->permissionRoute->where('permission_id', '=', $permission->id)->get();
             foreach ($routes as $route) {
                 if ($route->route == $uri) {
                     return true;
                 }
             }
         }
     }
     return false;
 }
开发者ID:JimiOhrid,项目名称:shopStore,代码行数:22,代码来源:Authorization.php

示例3: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $role = Role::findOrFail($id);
     $permissions = Role::findOrFail($id)->permissions()->get();
     $all_permissions = Permission::all();
     return view('pages.admin_pages.role')->with('role', $role)->with('all_permissions', $all_permissions)->with('permissions', $permissions);
 }
开发者ID:abreban,项目名称:RGU,代码行数:13,代码来源:RoleController.php

示例4: edit

 /**
  * edit data page
  * @param int id
  * @return view
  */
 public function edit($id)
 {
     $role = Role::findOrFail($id);
     $role_permission = DB::table('permission_role')->where('role_id', $id)->select('permission_id')->get();
     $permission = Permission::all(['id', 'name']);
     return view('admin.role.edit', compact('role', 'role_permission', 'permission'));
 }
开发者ID:Jokeramc,项目名称:amc,代码行数:12,代码来源:RoleController.php

示例5: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Role::create(['name' => 'manager_receive', 'label' => 'Manager of Receive.']);
     Role::create(['name' => 'manager_requesition', 'label' => 'Manager of Requesition.']);
     Role::create(['name' => 'manager_product_list', 'label' => 'Manager of Product list.']);
     Role::create(['name' => 'manager_product', 'label' => 'Manager of Product.']);
     Role::create(['name' => 'manager_product_type', 'label' => 'Manager of Product Type.']);
     Role::create(['name' => 'manager_unit', 'label' => 'Manager of Unit.']);
     Role::create(['name' => 'manager_location', 'label' => 'Manager of Location.']);
     Role::create(['name' => 'manager_project', 'label' => 'Manager of Project.']);
     Role::create(['name' => 'manager_user', 'label' => 'Manager of User.']);
     Permission::create(['name' => 'create_form', 'label' => 'Create of form.']);
     Permission::create(['name' => 'update_form', 'label' => 'Update of form.']);
     Permission::create(['name' => 'delete_form', 'label' => 'Delete of form.']);
     $roles = Role::all();
     $permissions = Permission::all();
     foreach ($roles as $role) {
         foreach ($permissions as $permission) {
             $role->givePermissionTo($permission);
         }
     }
     $user = User::whereEmail('n_vasit@hotmail.com')->first();
     foreach ($roles as $role) {
         $user->assignRole($role->name);
     }
     $user = User::whereEmail('akarin@mixed.co.th')->first();
     foreach ($roles as $role) {
         $user->assignRole($role->name);
     }
 }
开发者ID:vasitjuntong,项目名称:mixed,代码行数:35,代码来源:RolesSeeder.php

示例6: index

 /**
  * Table of all roles and their permissions
  *
  * @return \Illuminate\View\View
  */
 public function index()
 {
     $roles = Role::all();
     $permissions = Permission::all();
     $routes = PermissionRoute::select('route', 'id', 'permission_id')->get();
     return view('rbac-gui.roles_permissions.index', compact('roles', 'permissions', 'routes'));
 }
开发者ID:JimiOhrid,项目名称:shopStore,代码行数:12,代码来源:RolesPermissionsController.php

示例7: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     //
     $usergroup = \App\Usergroup::findOrFail($id);
     $permissions = \App\Permission::all();
     return view('usergroups.edit', compact('usergroup', 'permissions'));
 }
开发者ID:afdalwahyu,项目名称:lnms,代码行数:13,代码来源:UsergroupsController.php

示例8: permissions

 public static function permissions($type = null, $data = null)
 {
     if ($type and $data) {
         return Permission::where($type, $data)->get();
     }
     return Permission::all();
 }
开发者ID:ConsoleTVs,项目名称:Laralum,代码行数:7,代码来源:Laralum.php

示例9: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $permissions = Permission::all();
     $role = Role::find($id);
     $permission_role = $role->r_permission;
     return View('role.edit', compact('role', 'permissions', 'permission_role'));
 }
开发者ID:adit33,项目名称:inventory,代码行数:13,代码来源:RoleController.php

示例10: permission

 public static function permission($permission, $encontristaId)
 {
     if (!self::guest($permission)) {
         return is_null(Permission::all()->where('encontrista_id', '=', $encontristaId)->where('permission', '=', $permission)->first());
     }
     return true;
 }
开发者ID:R3Moura,项目名称:Rede-Encontrista,代码行数:7,代码来源:Permission.php

示例11: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $user;
     switch (strtolower($this->option('permission'))) {
         case 'admin':
             $user = new User();
             $user->username = 'admin';
             $user->password = Hash::make('admin');
             $user->email = 'admin@example.com';
             $user->firstname = 'Joshua';
             $user->middlename = 'Agagdan';
             $user->lastname = 'Tundag';
             Permission::first()->users()->save($user);
             $user->save();
             break;
         case 'user':
             $user = new User();
             $user->username = 'ododz';
             $user->password = Hash::make('gwapodz');
             $user->email = 'odozd@gwapodz.com';
             $user->firstname = 'Ododz';
             $user->middlename = 'G';
             $user->lastname = 'Gwapodz';
             Permission::all()->get(1)->users()->save($user);
             $user->save();
             break;
     }
     return $user;
 }
开发者ID:crow1796,项目名称:technologyRIS,代码行数:34,代码来源:CreateUserCommand.php

示例12: patchIndex

 public function patchIndex(Role $role)
 {
     if (!$this->user->canAdminRoles() || !$this->user->canAdminPermissions()) {
         return abort(403);
     }
     $input = Input::all();
     $permissions = Permission::all();
     $rolePermissions = [];
     $nullPermissions = [];
     foreach ($permissions as $permission) {
         if ($this->user->can($permission->permission_id)) {
             $nullPermissions[] = $permission->permission_id;
             foreach ($input as $permission_id => $permission_value) {
                 $permission_id = str_replace("_", ".", $permission_id);
                 if ($permission->permission_id == $permission_id) {
                     switch ($permission_value) {
                         case "allow":
                         case "deny":
                             $rolePermissions[] = ['role_id' => $role->role_id, 'permission_id' => $permission_id, 'value' => $permission_value == "allow"];
                             break;
                     }
                     break;
                 }
             }
         }
     }
     RolePermission::where(['role_id' => $role->role_id])->whereIn('permission_id', $nullPermissions)->delete();
     RolePermission::insert($rolePermissions);
     return $this->view(static::VIEW_PERMISSIONS, ['role' => $role, 'permissions' => Permission::all()]);
 }
开发者ID:ee-ee,项目名称:infinity-next,代码行数:30,代码来源:PermissionsController.php

示例13: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Request $request)
 {
     $permissions = Permission::all();
     if ($permissions) {
         return $this->respondWithCollection($permissions, new PermissionTransformer());
     }
     return $this->errorNotFound('No permissions found');
 }
开发者ID:jasonb8293,项目名称:fox-api,代码行数:13,代码来源:PermissionController.php

示例14: create

 public function create()
 {
     try {
         return view('Admin.roles.create', ['roles' => Rolle::all(), 'permissions' => Permission::all()]);
     } catch (Exception $e) {
         return redirect()->route('admin::roles::list')->withErrors($e->getMessage());
     }
 }
开发者ID:tassianoalencar,项目名称:mercurios-roles,代码行数:8,代码来源:RolesController.php

示例15: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $role = Role::create(['name' => 'Admin']);
     foreach (Permission::all() as $permission) {
         $role->permissions()->save($permission);
     }
     Role::create(['name' => 'User']);
 }
开发者ID:tassianoalencar,项目名称:mercurios-roles,代码行数:13,代码来源:RolesTableSeeder.php


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