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