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


PHP Booking::orderBy方法代碼示例

本文整理匯總了PHP中Booking::orderBy方法的典型用法代碼示例。如果您正苦於以下問題:PHP Booking::orderBy方法的具體用法?PHP Booking::orderBy怎麽用?PHP Booking::orderBy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Booking的用法示例。


在下文中一共展示了Booking::orderBy方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: index

 public function index()
 {
     $this->layout->with('subtitle', 'Bookings');
     $bookings = Booking::orderBy('last')->orderBy('first');
     $filtered = false;
     $filter_name = Session::get('bookings_filter_name', '');
     $filter_church = Session::get('bookings_filter_church', '');
     $filter_eventbrite = Session::get('bookings_filter_eventbrite', '');
     $filter_registered = Session::get('bookings_filter_registered', '');
     $filter_not_registered = Session::get('bookings_filter_not_registered', '');
     $filter_saturday = Session::get('bookings_filter_saturday', '');
     $filter_not_saturday = Session::get('bookings_filter_not_saturday', '');
     if (!empty($filter_name)) {
         $bookings = $bookings->where(function ($query) use($filter_name) {
             $query->where('bookings.first', 'LIKE', "%{$filter_name}%")->orWhere('bookings.last', 'LIKE', "%{$filter_name}%");
         });
         $filtered = true;
     }
     if (!empty($filter_church)) {
         $bookings = $bookings->where('source', 'Church');
         $filtered = true;
     }
     if (!empty($filter_eventbrite)) {
         $bookings = $bookings->where('source', 'EventBrite');
         $filtered = true;
     }
     if (($filter_registered || $filter_not_registered) && !($filter_registered && $filter_not_registered)) {
         if ($filter_registered) {
             $ids = DB::table('booking_registration_counts')->whereRaw('tickets <= registrations')->lists('id');
             if ($ids) {
                 $bookings = $bookings->whereIn('id', $ids);
             }
         } else {
             $ids = DB::table('booking_registration_counts')->whereRaw('tickets > registrations')->lists('id');
             if ($ids) {
                 $bookings = $bookings->whereIn('id', $ids);
             }
         }
     }
     if (($filter_saturday || $filter_not_saturday) && !($filter_saturday && $filter_not_saturday)) {
         if ($filter_saturday) {
             $bookings = $bookings->where('saturday', true);
         } else {
             $bookings = $bookings->where('saturday', false);
         }
         $filtered = true;
     }
     $bookings = $bookings->paginate(25);
     $this->layout->content = View::make('bookings.index')->with('bookings', $bookings)->with('filtered', $filtered)->with('filter_name', $filter_name)->with('filter_church', $filter_church)->with('filter_eventbrite', $filter_eventbrite)->with('filter_registered', $filter_registered)->with('filter_not_registered', $filter_not_registered)->with('filter_saturday', $filter_saturday)->with('filter_not_saturday', $filter_not_saturday);
 }
開發者ID:ajwgibson,項目名稱:illuminate,代碼行數:50,代碼來源:BookingController.php

示例2: getManage

 public function getManage()
 {
     return View::make('bookings.manage')->with('bookings', Booking::orderBy('created_at', 'DESC')->paginate(10));
 }
開發者ID:madiarsa,項目名稱:laravel-4.1-car-rental-site,代碼行數:4,代碼來源:BookingsController.php


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