本文整理汇总了PHP中app\Page::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::orderBy方法的具体用法?PHP Page::orderBy怎么用?PHP Page::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Page
的用法示例。
在下文中一共展示了Page::orderBy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: boot
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot(Guard $auth)
{
view()->composer('*', function ($view) {
$pages = Page::orderBy('position', 'asc')->get();
$view->with('pages', $pages);
});
view()->composer('*', function ($view) {
$view->with('currentUser', Auth::user());
});
view()->composer('sidebar.special', function ($view) {
$specialProduct = Product::where('special', 1)->get();
$view->with('specialProduct', $specialProduct);
});
view()->composer('sidebar.admin', function ($view) {
$today = \Carbon\Carbon::today();
$orders = DB::table('orders')->where('dateOrdered', '=', $today)->where('status_id', '>', 1)->count('id');
$view->with('orders', $orders);
});
view()->composer('sidebar.admin', function ($view) {
$today = date('l');
$hours = DB::table('hours')->where('day', $today)->value('hours');
$view->with('hours', $hours);
});
view()->composer('sidebar.admin', function ($view) {
$batches = Batch::where('proddate', \Carbon\Carbon::today())->count();
$view->with('batches', $batches);
});
view()->composer('sidebar.admin', function ($view) {
$date = date('Y-m-d');
$shift = Shift::where('date', $date)->pluck('id');
$employeees = Shift::find($shift)->users()->count();
$view->with('employeees', $employeees);
});
view()->composer('sidebar.special', function ($view) {
$categories = Category::all();
$view->with('categories', $categories);
});
view()->composer('*', function ($view) use($auth) {
$user = Auth::user();
if (Auth::user()) {
$cart = DB::table('orders')->select('id')->where('status_id', '=', 1)->where('user_id', '=', $user->id)->value('id');
$cartItems = DB::table('order_products')->where('order_id', '=', $cart)->sum('quantity');
$view->with('cartItems', $cartItems);
}
});
}
示例2: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$pages = Page::orderBy('sorter')->paginate(10);
return view('admin.page.index', ['pages' => $pages]);
}
示例3: index
/**
* Show the application dashboard to the user.
*
* @return Response
*/
public function index()
{
$page = Page::orderBy('updated_at', 'desc')->get();
return view('home')->withPages($page);
}
示例4: account
/**
* Display user account dashboard.
*
* @return Response
*/
public function account()
{
$user = Auth::user();
$pages = Page::orderBy('updated_at', 'desc')->take(5)->get();
$portfolio_items = Portfolio::orderBy('updated_at', 'desc')->take(5)->get();
return view('user.account', ['user' => $user, 'pages' => $pages, 'portfolio_items' => $portfolio_items]);
}