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


PHP Role::orderBy方法代碼示例

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


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

示例1: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $this->authorize('permissions-edit');
     $permission = Permission::with('roles')->findOrFail($id);
     $roles = Role::orderBy('display_name')->get();
     return view('permissions.edit', compact('permission', 'roles'));
 }
開發者ID:guenthertheilen,項目名稱:laravel-boilerplate,代碼行數:13,代碼來源:PermissionsController.php

示例2: getAllRoles

 /**
  * @param string $order_by
  * @param string $sort
  * @param bool $withPermissions
  * @return mixed
  */
 public function getAllRoles($order_by = 'id', $sort = 'asc', $withPermissions = false)
 {
     if ($withPermissions) {
         return Role::with('permissions')->orderBy($order_by, $sort)->get();
     }
     return Role::orderBy($order_by, $sort)->get();
 }
開發者ID:num3thod,項目名稱:laravel-5-boilerplate,代碼行數:13,代碼來源:EloquentRoleRepository.php

示例3: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  *
  * @return Response
  */
 public function edit($id)
 {
     $user = User::findOrFail($id);
     $roles_user = User::find($id)->roles()->lists('role_id')->toArray();
     $roles = Role::orderBy('display_name', 'asc')->lists('display_name', 'id');
     return view('admin.users.edit', compact('user', 'roles', 'roles_user'));
 }
開發者ID:wilderguzman,項目名稱:lugrawibe,代碼行數:14,代碼來源:UsersController.php

示例4: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $users = User::orderBy('firstname')->paginate(12);
     $teams = Team::orderBy('team_name')->get();
     $roles = Role::orderBy('role_name')->get();
     return view('cp.users.index', compact('users', 'teams', 'roles'));
 }
開發者ID:NuLeaf,項目名稱:nuleaf-website,代碼行數:12,代碼來源:UsersController.php

示例5: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $this->authorize('users-edit');
     $user = User::with('roles')->findOrFail($id);
     $roles = Role::orderBy('display_name')->get();
     return view('users.edit', compact('roles', 'user'));
 }
開發者ID:guenthertheilen,項目名稱:laravel-boilerplate,代碼行數:13,代碼來源:UsersController.php

示例6: user

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function user()
 {
     $users = User::with('roles')->get();
     $roles = Role::orderBy('name')->get();
     $users_json = $users->toArray();
     $data = compact('users', 'roles', 'users_json');
     return view('user.user', $data);
 }
開發者ID:ibnoe,項目名稱:trustline,代碼行數:13,代碼來源:UserController.php

示例7: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $user = User::findOrFail($id);
     $roles = Role::orderBy('name')->lists('name', 'id');
     // dd($roles);
     $status = ['0' => 'In-active', '1' => 'Active'];
     return view('store_user.edit', compact('roles', 'user', 'status'));
 }
開發者ID:renciebautista,項目名稱:pcount2,代碼行數:14,代碼來源:StoreUserController.php

示例8: run

 public function run()
 {
     DB::table('users')->delete();
     $roles = Role::orderBy('id')->get(array('id'));
     User::create(array('name' => 'entreprise1', 'email' => 'entreprise1@gmail.com', 'password' => Hash::make('azerty'), 'role_id' => $roles[3]->id, 'valide' => 1, 'user_type' => 'App\\Entreprise', 'user_id' => '1'));
     User::create(array('name' => 'moderateur1', 'email' => 'moderateur1@gmail.com', 'password' => Hash::make('azerty'), 'role_id' => $roles[1]->id, 'valide' => 1, 'user_type' => 'App\\Moderateur', 'user_id' => '1'));
     User::create(array('name' => 'admin1', 'email' => 'admin1@gmail.com', 'password' => Hash::make('azerty'), 'role_id' => $roles[0]->id, 'valide' => 1, 'user_type' => 'App\\Administrateur', 'user_id' => '1'));
     User::create(array('name' => 'etudiant1', 'email' => 'etudiant1@gmail.com', 'password' => Hash::make('azerty'), 'role_id' => $roles[2]->id, 'valide' => 1, 'user_type' => 'App\\Etudiant', 'user_id' => '1'));
 }
開發者ID:Anassdev,項目名稱:AdopteUnStage,代碼行數:9,代碼來源:UserTableSeeder.php

示例9: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit(General $general, Group $group)
 {
     $theme = $general->theme();
     $roles = Role::orderBy('level')->lists('name', 'id');
     $theme['title'] = 'Edit Group';
     $theme['description'] = 'edit group entry';
     $button_text = 'Update Group';
     return view('admin.group.edit', compact('theme', 'group', 'roles', 'button_text'));
 }
開發者ID:ronal2do,項目名稱:Laravel-CMS,代碼行數:15,代碼來源:GroupController.php

示例10: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     if (Auth::check() && $this->rolechucnangs && $this->rolechucnangs->Them == 1) {
         $roles = Role::orderBy('name')->get();
         $dois = Danhmucdoi::orderBy('name')->get();
         $phongs = Danhmucphong::orderBy('name')->get();
         $chucvus = Danhmucchucvu::get();
         $capbacs = Danhmuccapbac::get();
         return view('user.create')->with(array('menus' => $this->menus, 'roles' => $roles, 'dois' => $dois, 'phongs' => $phongs, 'chucvus' => $chucvus, 'capbacs' => $capbacs));
     } else {
         return \Redirect::route('user.index')->with('message-error', 'Không có quyền truy cập');
     }
 }
開發者ID:thaigialai1987,項目名稱:qlcv,代碼行數:18,代碼來源:UserController.php

示例11: roles

 public function roles(Request $request)
 {
     $page = 1;
     $limit = 0;
     if ($request->limit) {
         $limit = $request->limit;
     }
     if ($request->page) {
         $page = $request->page;
     }
     //        $roles = Role::orderBy('created_at', 'desc')->skip(($page - 1) * $limit)->take($limit)->get();
     $roles = Role::orderBy('created_at', 'desc')->get();
     return response()->json($roles, 200);
 }
開發者ID:Kaelcao,項目名稱:colormev2,代碼行數:14,代碼來源:RoleController.php

示例12: changeRole

 public function changeRole(Request $request)
 {
     $user_id = $request->user_id;
     $role_id = $request->role_id;
     if ($user_id == 1) {
         return response()->json(['status' => 401, 'msg' => '不能修改超級管理員的用戶組']);
     }
     $user = User::find($user_id, ['id']);
     $role = Role::find($role_id, ['id']);
     if (empty($user) || empty($role)) {
         return response()->json(['status' => 404, 'msg' => '用戶或用戶組不存在']);
     }
     $user->assignRole($role->id);
     $roles = Role::orderBy('id', 'DESC')->get(['id', 'name']);
     $html = view()->make('admin.users._user_roles', compact('roles', 'user'))->render();
     return response()->json(['status' => 200, 'html' => $html]);
 }
開發者ID:misterebs,項目名稱:cmsku,代碼行數:17,代碼來源:UserController.php

示例13: create

 public function create()
 {
     $roles = Role::orderBy('name')->get();
     $users = User::orderBy('name')->paginate(20);
     return view('auth.create-user', compact('users', 'roles'));
 }
開發者ID:snehachavan21,項目名稱:timesheet,代碼行數:6,代碼來源:UserController.php

示例14: GetDftrLevel

 public function GetDftrLevel($lvl = '')
 {
     $level = Role::orderBy('id', 'asc')->get();
     $a = '';
     foreach ($level as $key => $value) {
         $ck = strpos($lvl, "." . $value->id) === false ? '' : 'checked';
         $a .= "<input type='checkbox' name='level[]' class='' value='{$value->id}' {$ck}> {$value->id} - {$value->name}";
     }
     return $a;
 }
開發者ID:muhamadanjar,項目名稱:rth,代碼行數:10,代碼來源:LayerController.php

示例15: getAllRolesPaginated

 public static function getAllRolesPaginated($pages)
 {
     return Role::orderBy("updated_at", "DESC")->paginate($pages);
 }
開發者ID:gpawlik,項目名稱:laravel-projects-codebase,代碼行數:4,代碼來源:RoleRepository.php


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