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