本文整理汇总了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);
}
示例2: getManage
public function getManage()
{
return View::make('bookings.manage')->with('bookings', Booking::orderBy('created_at', 'DESC')->paginate(10));
}