当前位置: 首页>>代码示例>>PHP>>正文


PHP Permission::orderBy方法代码示例

本文整理汇总了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'));
 }
开发者ID:sroutier,项目名称:laravel-5.1-enterprise-starter-kit,代码行数:33,代码来源:MenusController.php

示例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();
 }
开发者ID:aysenli,项目名称:laravel5-backend,代码行数:13,代码来源:PermissionRepository.php

示例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");
 }
开发者ID:ardiqghenatya,项目名称:koptel2,代码行数:8,代码来源:PermissionRepository.php

示例4: getAllOrderedBy

 public function getAllOrderedBy($column = 'id', $order = 'asc')
 {
     $permissionss = Permission::orderBy($column, $order)->get();
     return $permissionss;
 }
开发者ID:jaumesala,项目名称:opendata-maps,代码行数:5,代码来源:PermissionRepository.php

示例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]);
 }
开发者ID:rxfu,项目名称:jspx,代码行数:10,代码来源:PermissionController.php

示例6: getIndex

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function getIndex()
 {
     return view("admin.user.permissions")->with("permissions", Permission::orderBy("level")->get());
 }
开发者ID:thevruno,项目名称:my-own-blog,代码行数:9,代码来源:PermissionsController.php


注:本文中的app\models\Permission::orderBy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。