本文整理汇总了PHP中Registration::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Registration::orderBy方法的具体用法?PHP Registration::orderBy怎么用?PHP Registration::orderBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Registration
的用法示例。
在下文中一共展示了Registration::orderBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Displays a tabular list of registrations.
*/
public function index()
{
$this->layout->with('subtitle', 'Registrations');
$registrations = Registration::orderBy('registrations.created_at', 'desc')->join('bookings', 'registrations.booking_id', '=', 'bookings.id', 'left outer')->addSelect('registrations.*')->addSelect('bookings.first')->addSelect('bookings.last')->addSelect('bookings.email');
$filtered = false;
$filter_name = Session::get('registrations_filter_name', '');
$filter_email = Session::get('registrations_filter_email', '');
$filter_friday = Session::get('registrations_filter_friday', '');
$filter_saturday = Session::get('registrations_filter_saturday', '');
if (!empty($filter_name)) {
$registrations = $registrations->where(function ($query) use($filter_name) {
$query->where('bookings.first', 'LIKE', "%{$filter_name}%")->orWhere('bookings.last', 'LIKE', "%{$filter_name}%")->orWhere('registrations.name', 'LIKE', "%{$filter_name}%");
});
$filtered = true;
}
if (!empty($filter_email)) {
$registrations = $registrations->where(function ($query) use($filter_email) {
$query->where('bookings.email', 'LIKE', "%{$filter_email}%")->orWhere('registrations.email_address', 'LIKE', "%{$filter_email}%");
});
$filtered = true;
}
if (!empty($filter_friday)) {
$registrations = $registrations->where(DB::raw('DAYOFWEEK(registrations.created_at)'), '=', 6);
$filtered = true;
}
if (!empty($filter_saturday)) {
$registrations = $registrations->where(DB::raw('DAYOFWEEK(registrations.created_at)'), '=', 7);
$filtered = true;
}
$registrations = $registrations->paginate(25);
$this->layout->content = View::make('registrations.index')->with('registrations', $registrations)->with('filtered', $filtered)->with('filter_name', $filter_name)->with('filter_email', $filter_email)->with('filter_friday', $filter_friday)->with('filter_saturday', $filter_saturday);
}
示例2: getRankedsub
public function getRankedsub()
{
return var_dump(Registration::orderBy("rank", "ASC")->get()->toArray());
}