本文整理汇总了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'));
}
示例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();
}
示例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'));
}
示例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'));
}
示例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'));
}
示例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);
}
示例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'));
}
示例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'));
}
示例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'));
}
示例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');
}
}
示例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);
}
示例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]);
}
示例13: create
public function create()
{
$roles = Role::orderBy('name')->get();
$users = User::orderBy('name')->paginate(20);
return view('auth.create-user', compact('users', 'roles'));
}
示例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;
}
示例15: getAllRolesPaginated
public static function getAllRolesPaginated($pages)
{
return Role::orderBy("updated_at", "DESC")->paginate($pages);
}