本文整理汇总了PHP中app\models\Permission::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Permission::orderBy方法的具体用法?PHP Permission::orderBy怎么用?PHP Permission::orderBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Permission
的用法示例。
在下文中一共展示了Permission::orderBy方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* @return \Illuminate\View\View
*/
public function index()
{
// Log action by user.
Audit::log(Auth::user()->id, trans('admin/menu-builder/menu-builder.audit-log.category'), trans('admin/menu-builder/menu-builder.audit-log.msg-index'));
// Set page title and description.
$page_title = trans('admin/menu-builder/menu-builder.page.index.title');
$page_description = trans('admin/menu-builder/menu-builder.page.index.description');
// Load all menus ordered by Parent (asc), Position (asc), Label (asc) and finally ID (asc).
$menus = Menu::orderBy('parent_id', 'ASC')->orderBy('position', 'ASC')->orderBy('label', 'ASC')->orderBy('id', 'ASC')->get();
// Convert menu query result to JSON for JSTree
$menusJson = $this->menusOrmToJsTreeJson($menus);
// List label and id of all menus ordered by Label (asc).
$parents = Menu::where('separator', '0')->orderBy('label', 'ASC')->orderBy('id', 'ASC')->get()->lists('label', 'id');
// Convert to array.
$parents = $parents->toArray();
// List name and id of all routes ordered by Name (asc).
$routes = Route::whereNotNull('name')->orderBy('name', 'ASC')->get()->lists('name', 'id');
// Convert to array.
$routes = $routes->toArray();
// Add a blank option at the top.
$routes = array('blank' => '') + $routes;
// List display name and id of all permissions ordered by Name (asc).
$permissions = Permission::orderBy('name', 'ASC')->get()->lists('display_name', 'id');
// Convert to array.
$permissions = $permissions->toArray();
// Add a blank option at the top.
$permissions = array('blank' => '') + $permissions;
// Return view
return view('admin.menus.index', compact('menus', 'menusJson', 'parents', 'routes', 'permissions', 'page_title', 'page_description'));
}
示例2: 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();
}
示例3: lastUpdated
public function lastUpdated()
{
$query = Permission::orderBy('updated_at', 'DESC')->first();
if ($query) {
return $query->updated_at->format('Y-m-d H:i:s');
}
return date("Y-m-d H:i:s");
}
示例4: getAllOrderedBy
public function getAllOrderedBy($column = 'id', $order = 'asc')
{
$permissionss = Permission::orderBy($column, $order)->get();
return $permissionss;
}
示例5: getList
/**
* Display a listing of the resource.
*
* @return Response
*/
public function getList()
{
$permissions = Permission::orderBy('name', 'asc')->get();
return view('permission.list', ['title' => '权限列表', 'permissions' => $permissions]);
}
示例6: getIndex
/**
* Display a listing of the resource.
*
* @return Response
*/
public function getIndex()
{
return view("admin.user.permissions")->with("permissions", Permission::orderBy("level")->get());
}