当前位置: 首页>>代码示例>>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;未经允许,请勿转载。