本文整理汇总了PHP中app\models\Menu::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Menu::orderBy方法的具体用法?PHP Menu::orderBy怎么用?PHP Menu::orderBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Menu
的用法示例。
在下文中一共展示了Menu::orderBy方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
Title::prepend('Menu');
$data = ['items' => Menu::orderBy('position', 'asc')->orderBy('sort', 'asc')->get(), 'title' => Title::renderr(' : ', true)];
view()->share('menu_item_active', 'menu');
return view('root.menu.index', $data);
}
示例2: 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'));
}
示例3: index
public function index()
{
$data = ['items' => Menu::orderBy('position', 'asc')->orderBy('sort', 'asc')->get(), 'title' => 'Menu'];
$this->title->prepend($data['title']);
View::share('menu_item_active', 'menu');
return view('root.menu.index', $data);
}
示例4: compose
/**
* 将数据绑定到视图。
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
//查询当前登录用户
$admin = Auth::guard('admin')->user();
if ($admin->admin_name == 'admin') {
$menus = Menu::orderBy('sort', 'ASC')->get()->toTree();
} else {
if ($admin->role) {
$ids = DB::table('sys_role_function')->where('sys_role_id', $admin->role[0]->id)->pluck('sys_fun_id');
$menus = Menu::orderBy('sort', 'ASC')->whereIn('id', $ids)->get()->toTree();
}
}
$currentRoute = Route::currentRouteName();
$list = explode('.', $currentRoute);
$route = '';
for ($i = 0; $i < count($list) - 1; $i++) {
if ($i == 0) {
$route .= $list[$i];
} else {
$route .= '.' . $list[$i];
}
}
$route = $route . '.index';
$view->with('currentRoute', $route)->with('trees', $menus);
}
示例5: getIndex
public function getIndex()
{
$weight_list = [];
$menuitem_count = Menu::all()->count();
for ($i = 1; $i <= $menuitem_count; $i++) {
$weight_list[$i] = $i;
}
return view('admin.menu.index', ['menuitems' => Menu::orderBy('weight')->get(), 'weight_list' => $weight_list]);
}
示例6: menuList
public function menuList()
{
$menu = Menu::orderBy('id', 'asc')->get();
return view('admin.menu.index', ['menu' => $menu]);
}
示例7: function
<?php
// Home
Route::get('/', ['uses' => 'HomeController@index', 'as' => 'home']);
View::composer('partials.menu', function ($view) {
$view->with('menuitems', \App\Models\Menu::orderBy('weight')->get());
});
View::composer('partials.categories', function ($view) {
$view->with('categories', \App\Models\Category::tree());
});
View::composer('banners.index', function ($view) {
$view->with('banners', \App\Models\Banner::all());
});
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController', 'products' => 'ProductController', 'user' => 'UserController', 'cart' => 'CartController']);
Route::group(['middleware' => ['auth']], function () {
Route::controllers(['order' => 'OrderController', 'user' => 'UserController']);
});
/* < Admin > */
Route::get('admin', function () {
return Redirect::to('admin/products');
});
Route::get('/ipn', 'Robokassa\\RobokassaController@getResult');
Route::post('/create_payment', 'Robokassa\\PaymentController@createPayment');
Route::group(['middleware' => ['auth', 'admin']], function () {
Route::controllers(['admin/orders' => 'Admin\\OrderController', 'admin/order_products' => 'Admin\\OrderProductController', 'admin/categories' => 'Admin\\CategoryController', 'admin/products' => 'Admin\\ProductController', 'admin/productimage' => 'Admin\\ProductImageController', 'admin/users' => 'Admin\\UserController', 'admin/menu' => 'Admin\\MenuController', 'admin/currency' => 'Admin\\CurrencyController', 'admin/slider' => 'Admin\\SliderController', 'admin/blocks_content' => 'Admin\\BlocksContentController', 'admin/blocks_content_products' => 'Admin\\BlocksContentProductsController', 'admin/stat' => 'Admin\\StatisticController', 'admin/banners' => 'Admin\\BannerController']);
});
/* </ Admin > */
Route::any("/{slug}", array("as" => "content", "uses" => "MenuController@content"));
示例8: boot
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
View::composer('partials.menu', function ($view) {
$view->with('menuitems', \App\Models\Menu::orderBy('weight')->get());
});
}
示例9: apiDataMenu
public function apiDataMenu()
{
$data = Menu::orderBy('id', 'desc')->get();
return response()->json($data);
}
示例10: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$waste = Wastes::findOrFail($id);
$currentPeriodId = Helper::defaultPeriodId();
$periods = StockPeriods::all();
$period_list = array();
foreach ($periods as $period) {
$period_list[$period->id] = 'Stock #' . $period->number . ' (' . $period->date_from . ' - ' . ($period->id == $currentPeriodId ? 'NOW' : $period->date_to) . ')';
}
if (Input::has('stock_period')) {
$currentPeriodId = Input::get('stock_period');
}
$select_recipes = Recipes::orderBy('title', 'ASC')->lists('title', 'id');
$items = ItemUnits::orderBy('default', 'DESC')->get();
$items_units = [];
foreach ($items as $item) {
$items_units['list'][$item->item()->first()->id][] = ['id' => $item->id, 'title' => $item->unit()->first()->title];
$items_units['php_list'][$item->item()->first()->id][$item->id] = $item->unit()->first()->title;
$items_units['factors'][$item->id] = $item->factor;
}
$select_items = Items::orderBy('title', 'ASC')->lists('title', 'id');
$select_menus = Menu::orderBy('title', 'ASC')->lists('title', 'id');
$select_reasons = WasteReasons::orderBy('reason', 'ASC')->lists('reason', 'id');
return view('Wastes.edit')->with(array('title' => $this->title, 'recipes' => $select_recipes, 'items' => $select_items, 'items_units' => $items_units, 'menus' => $select_menus, 'period' => $currentPeriodId, 'stocks_list' => $period_list, 'reasons' => $select_reasons, 'waste' => $waste));
}
示例11: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
return view('Menus.index')->with(array('title' => $this->title, 'items' => Menu::orderBy('checked', 'ASC')->orderBy('title', 'ASC')->get()));
}