當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。