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


PHP Role::all方法代码示例

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


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

示例1: roles

 public function roles($id)
 {
     $this->authorize('user_view_roles');
     $user = User::find($id);
     $roles = Role::all();
     return view('admin.users.roles', compact('user', 'roles'));
 }
开发者ID:phelipperibeiro,项目名称:book_store_laravel,代码行数:7,代码来源:UsersController.php

示例2: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit(User $User)
 {
     $this->data['Roles'] = Role::all();
     $this->data['Groups'] = Group::all();
     $this->data['User'] = $User;
     return view('admin.users.edit', $this->data);
 }
开发者ID:DJZT,项目名称:tezter,代码行数:13,代码来源:UsersController.php

示例3: form

 /**
  * Returns a new form for the specified user.
  *
  * @param User $user
  *
  * @return \Orchestra\Contracts\Html\Builder
  */
 public function form(User $user)
 {
     return $this->form->of('users', function (FormGrid $form) use($user) {
         if ($user->exists) {
             $method = 'PATCH';
             $url = route('admin.users.update', [$user->getKey()]);
             $form->submit = 'Save';
         } else {
             $method = 'POST';
             $url = route('admin.users.store');
             $form->submit = 'Create';
         }
         $form->attributes(compact('method', 'url'));
         $form->with($user);
         $form->fieldset(function (Fieldset $fieldset) use($user) {
             $fieldset->control('input:text', 'name')->attributes(['placeholder' => 'Enter the users name.']);
             $fieldset->control('input:text', 'email')->attributes(['placeholder' => 'Enter the users email address.']);
             if ($user->exists) {
                 $fieldset->control('input:select', 'roles[]')->label('Roles')->options(function () {
                     return Role::all()->pluck('label', 'id');
                 })->value(function (User $user) {
                     return $user->roles->pluck('id');
                 })->attributes(['class' => 'select-roles', 'multiple' => true]);
             }
             $fieldset->control('input:password', 'password')->attributes(['placeholder' => 'Enter a password to change the users password.']);
             $fieldset->control('input:password', 'password_confirmation')->attributes(['placeholder' => 'Enter the users password again.']);
         });
     });
 }
开发者ID:stevebauman,项目名称:administration,代码行数:36,代码来源:UserPresenter.php

示例4: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  *
  * @return mixed
  */
 public function edit($id)
 {
     $availableAppointment = AvailableAppointment::findOrFail($id);
     $fixtures = Fixture::all();
     $roles = Role::all();
     return view('admin.data-management.available-appointments.edit', compact('availableAppointment', 'fixtures', 'roles'));
 }
开发者ID:troccoli,项目名称:lva,代码行数:14,代码来源:AvailableAppointmentsController.php

示例5: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $user = User::find($id);
     $role = Role::find($user->type);
     $roles = Role::all();
     return view('user.edit', compact('user', 'role', 'roles'));
 }
开发者ID:bradsmithcan,项目名称:laravel_infusionsoft_constantcontact,代码行数:13,代码来源:UserController.php

示例6: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $roles = Role::all();
     $permissions = Permission::all();
     $usersWithRoles = User::with('roles')->orderBy('last_name')->get();
     return view('admin.roles.index', ['roles' => $roles, 'permissions' => $permissions, 'users' => $usersWithRoles]);
 }
开发者ID:scotthummel,项目名称:lambdaphx,代码行数:12,代码来源:RoleController.php

示例7: getAllRoles

 public function getAllRoles($relationships = null)
 {
     if (isset($relationships)) {
         return Role::with($relationships)->get();
     }
     return Role::all();
 }
开发者ID:gabwhite,项目名称:fsh,代码行数:7,代码来源:DataAccessLayer.php

示例8: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $permissions = $this->getAllActions();
     $actions = $this->getRouteData();
     $roles = Role::all();
     // Add new actions
     foreach ($actions as $action => $uri) {
         if (!array_key_exists($action, $permissions)) {
             $newAction = new Action(['action' => $action, 'uri' => $uri]);
             $newAction->save();
             $this->savePermissions($roles, $newAction);
             $this->info("Added " . $action . "\n");
         } else {
             unset($permissions[$action]);
         }
     }
     // Remove non existing actions
     foreach ($permissions as $action => $uri) {
         Action::where(['action' => $action, 'uri' => $uri])->first()->destroy();
         $this->comment("Removed " . $action . "\n");
     }
     $cache = $this->getCacheInstance(['permissions']);
     $cache->flush();
     $this->info("Done. \n");
 }
开发者ID:Denniskevin,项目名称:Laravel5Starter,代码行数:30,代码来源:AclUpdate.php

示例9: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $this->info("Clearing permissions... \n");
     // Delete old data
     $response = Action::deleteAllData();
     null !== $response ? $this->error("\n" . $response . "\n") : null;
     $this->info("Permissions cleared... \n");
     try {
         $routeData = $this->getRouteData();
         $roles = Role::all();
         DB::beginTransaction();
         foreach ($routeData as $action => $uri) {
             $action = new Action(['uri' => $uri, 'action' => $action]);
             $action->save();
             $this->savePermissions($roles, $action);
             $this->comment("Added action " . $action->action . "\n");
         }
         $cache = $this->getCacheInstance(['permissions']);
         $cache->flush();
         DB::commit();
     } catch (\Exception $e) {
         DB::rollBack();
         $this->error("\n" . $e->getMessage() . "\n");
     }
 }
开发者ID:Denniskevin,项目名称:Laravel5Starter,代码行数:30,代码来源:AclClear.php

示例10: edit

 /**
  * Add user page
  *
  * @return response
  */
 public function edit($id)
 {
     $roles = ['' => _t('backend_user_select_role')];
     foreach (Role::all() as $role) {
         $roles[$role->id] = $role->name;
     }
     return view('backend::user.form', ['user' => $this->_getUserById($id), 'roles' => $roles]);
 }
开发者ID:vuongabc92,项目名称:ot,代码行数:13,代码来源:UserController.php

示例11: getEdit

 public function getEdit($id)
 {
     $roles = [];
     foreach (Role::all() as $role) {
         $roles[$role->id] = $role->title;
     }
     return view('admin.users.details', ['user' => User::find($id), 'roles' => $roles]);
 }
开发者ID:venomir,项目名称:tc,代码行数:8,代码来源:UserController.php

示例12: allConPermisos

 public static function allConPermisos($detailed = false)
 {
     $roles = Role::all();
     foreach ($roles as $rol) {
         $rol->perms = $rol->permissions($detailed);
     }
     return $roles;
 }
开发者ID:bluesky777,项目名称:5myvc,代码行数:8,代码来源:Role.php

示例13: getRolesDropdownOptions

 /**
  * Get dropdown of all roles available for user
  *
  * @return mixed
  */
 public function getRolesDropdownOptions()
 {
     $allRoles = Role::all();
     foreach ($allRoles as $eachRole) {
         $results[$eachRole->id] = $eachRole->custom_role_name;
     }
     return $results;
 }
开发者ID:ryankim07,项目名称:testplanner,代码行数:13,代码来源:Tools.php

示例14: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     // $auths = Models\Role::find(12)->auths;
     // foreach($auths as $auth){
     // echo $auth->auth_name;
     // }
     return view('admin.role.index')->withRoles(Models\Role::all());
 }
开发者ID:honxin,项目名称:studentclub,代码行数:13,代码来源:RoleController.php

示例15: getRegister

 /**
  * Show the application registration form.
  *
  * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed
  */
 public function getRegister()
 {
     // Prepare dropdown for roles
     $allRoles = Role::all();
     foreach ($allRoles as $eachRole) {
         $rolesOptions[$eachRole->id] = $eachRole->custom_role_name;
     }
     $viewHtml = view('pages.main.user', ['mode' => 'register', 'user' => '', 'rolesOptions' => $rolesOptions, 'rolesSelectedOptions' => ''])->render();
     return response()->json(["viewBody" => $viewHtml]);
 }
开发者ID:ryankim07,项目名称:testplanner,代码行数:15,代码来源:AuthController.php


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