本文整理汇总了PHP中app\Order::whereRaw方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::whereRaw方法的具体用法?PHP Order::whereRaw怎么用?PHP Order::whereRaw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Order
的用法示例。
在下文中一共展示了Order::whereRaw方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Show the application dashboard.
*
* @return Response
*/
public function index()
{
$private = Order::whereRaw('(status = 1 OR status = 2) AND prio = 0')->orderBy('order_id', 'desc')->whereHas("customer", function ($query) {
$query->where("business", "=", '0');
})->get();
$company = Order::whereRaw('(status = 1 OR status = 2) AND prio = 0')->orderBy('order_id', 'desc')->whereHas("customer", function ($query) {
$query->where("business", "=", '1');
})->get();
$prio = Order::where('prio', '=', '1')->whereRaw('(status = 1 OR status = 2)')->orderBy('order_id')->with("customer")->get();
$finished = Order::whereStatus('4')->with('customer')->get();
return view('home', compact('private', 'company', 'prio', 'finished'));
}
示例2: getReport
public function getReport(Request $request)
{
$this->page->title = 'Заказы такси';
$this->page->desc = 'Текущие заказы';
// ПОЛЬЗОВАТЕЛЬ Текущие заказы
$user = User::where('company', '=', $request->input('company'))->get()->first();
$this->data['company'] = $user->company;
$this->data['date_from'] = $request->input('date_from');
$this->data['date_to'] = $request->input('date_to');
$this->data['orders'] = Order::whereRaw('user_id = ' . $user->id . ' AND (departure_time > now() OR arrivals_time > now())')->where('created_at', '>=', date("Y-m-d 00:00:00", strtotime($request->input('date_from'))))->where('created_at', '<=', date("Y-m-d 23:59:59", strtotime($request->input('date_to'))))->orderBy('created_at', 'DESC')->get();
// не олачено
$this->data['nopay_orders'] = Order::whereRaw('user_id = ' . $user->id . ' AND payment_status = 0 AND (departure_time < now() AND arrivals_time < now())')->where('created_at', '>=', date("Y-m-d 00:00:00", strtotime($request->input('date_from'))))->where('created_at', '<=', date("Y-m-d 23:59:59", strtotime($request->input('date_to'))))->orderBy('created_at', 'DESC')->get();
// отображение
return $this->render('reports.list-report');
}
示例3: getArchive
/**
* Архив заказов
*
* @return \Illuminate\View\View
*/
public function getArchive()
{
$this->page->title = 'Заказы такси';
$this->page->desc = 'Архив заказов';
// АДМИНИСТРАТОР Текущие заказы
if (Sentinel::inRole('admin')) {
$this->data['orders'] = Order::whereRaw('order_status = 3 AND payment_status = 1 AND (departure_time < now() and arrivals_time < now())')->orderBy('created_at', 'DESC')->get();
} else {
$this->data['orders'] = Order::whereRaw('order_status = 3 AND payment_status = 1 AND (departure_time < now() and arrivals_time < now())')->where('user_id', Sentinel::getUser())->orderBy('created_at', 'DESC')->get();
}
// АДМИНИСТРАТОР отображение
return $this->render('order.list-archive');
}