當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Page::orderBy方法代碼示例

本文整理匯總了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);
         }
     });
 }
開發者ID:samyerkes,項目名稱:sweet.com,代碼行數:51,代碼來源:AppServiceProvider.php

示例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]);
 }
開發者ID:vasiliy-mk,項目名稱:apartment-rent,代碼行數:10,代碼來源:PageController.php

示例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);
 }
開發者ID:Brave-Cheng,項目名稱:Laravel-5.0-Learning,代碼行數:10,代碼來源:HomeController.php

示例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]);
 }
開發者ID:edrobotij,項目名稱:portfolio,代碼行數:12,代碼來源:UserController.php


注:本文中的app\Page::orderBy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。