當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。