本文整理汇总了PHP中app\Permission::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Permission::orderBy方法的具体用法?PHP Permission::orderBy怎么用?PHP Permission::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Permission
的用法示例。
在下文中一共展示了Permission::orderBy方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllPermissions
/**
* @param string $order_by
* @param string $sort
* @param bool $withRoles
* @return mixed
*/
public function getAllPermissions($order_by = 'id', $sort = 'asc', $withRoles = true)
{
if ($withRoles) {
return Permission::with('roles')->orderBy($order_by, $sort)->get();
}
return Permission::orderBy($order_by, $sort)->get();
}
示例2: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$this->authorize('roles-edit');
$role = Role::with('permissions')->findOrFail($id);
$permissions = Permission::orderBy('display_name')->get();
return view('roles.edit', compact('permissions', 'role'));
}
示例3: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$menus = Menu::all();
$permissions = Permission::orderBy('updated_at', 'desc')->get();
//echo '<pre>';
//print_r($permissions);
return view('permission.index')->with(array('menus' => $this->menus, 'permissions' => $permissions));
}
示例4: role
public function role()
{
$roles = Role::with('perms')->get();
$perms = Permission::orderBy('name')->get();
$roles_json = $roles->toArray();
$data = compact('roles', 'perms', 'roles_json');
// dd($data);
return view('user.role', $data);
}
示例5: getSorted
public function getSorted()
{
$permissions = Permission::orderBy('name')->get();
$sorted = [];
foreach ($permissions as $permission) {
$modelname = substr($permission->name, 0, strrpos($permission->name, '_'));
if (!array_key_exists($modelname, $sorted)) {
$sorted[$modelname] = [];
}
array_push($sorted[$modelname], ['name' => $permission->name, 'id' => $permission->id, 'label' => substr($permission->name, strrpos($permission->name, '_') + 1)]);
}
return $sorted;
}
示例6: getAllPermissionsPaginated
public static function getAllPermissionsPaginated($pages)
{
return Permission::orderBy("permission_name", "ASC")->paginate($pages);
}
示例7: orderBy
public function orderBy($column)
{
return \App\Permission::orderBy($column)->get();
}
示例8: index
/**
* permission list
* @return view
*/
public function index()
{
$list = Permission::orderBy('id', 'desc')->paginate(config('shop.pagesize'));
return view('admin.permission.index', compact('list'));
}
示例9: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$user = $this->user->find($id);
$branch = $this->branch->where('id', '!=', 1)->where('company_id', Auth::user()->company_id)->where('account_year_id', session('account'))->orderBy('name', 'asc')->lists('name', 'id');
$perms = Permission::orderBy('name', 'asc')->lists('display_name', 'id');
return view('user.edit', compact('user', 'branch', 'perms'));
}