本文整理汇总了PHP中app\Order::whereIn方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::whereIn方法的具体用法?PHP Order::whereIn怎么用?PHP Order::whereIn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Order
的用法示例。
在下文中一共展示了Order::whereIn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index($sort = 'departure')
{
$this->page->title = 'Заказы такси';
$this->page->desc = 'Текущие заказы';
$this->data['sort'] = $sort;
if (Sentinel::inRole('admin')) {
// АДМИНИСТРАТОР Новые и редактированные заказы
$this->data['orders_new'] = Order::whereIn('order_status', array(1, 2))->orderBy('updated_at', 'desc')->get();
// АДМИНИСТРАТОР Текущие заказы
if ($sort == 'arrivals') {
// Сортировка по прилету
$this->data['orders'] = Order::whereRaw('order_status = 3 AND (departure_time > now() OR arrivals_time > now())')->orderBy('arrivals_time')->get();
} else {
// Сортировка по вылету
$this->data['orders'] = Order::whereRaw('order_status = 3 AND (departure_time > now() OR arrivals_time > now())')->orderBy('departure_time')->get();
}
// не олачено
$this->data['nopay_orders'] = Order::whereRaw('order_status = 3 AND payment_status = 0 AND (departure_time < now() and arrivals_time < now())')->orderBy('departure_time')->get();
$news = News::all();
// \Session::flash('messages', count($news));
foreach ($news as $key => $val) {
\Session::flash('flash_message_' . $key, $val->body);
}
// АДМИНИСТРАТОР отображение
return $this->render('order.list-admin');
} else {
// ПОЛЬЗОВАТЕЛЬ Текущие заказы
$this->data['orders'] = Order::whereRaw('user_id = ' . $this->user->id . ' AND (departure_time > now() OR arrivals_time > now())')->orderBy('created_at', 'DESC')->get();
// не олачено
$this->data['nopay_orders'] = Order::whereRaw('user_id = ' . $this->user->id . ' AND payment_status = 0 AND (departure_time < now() AND arrivals_time < now())')->orderBy('created_at', 'DESC')->get();
$news = News::all();
// \Session::flash('messages', count($news));
foreach ($news as $key => $val) {
\Session::flash('flash_message_' . $key, $val->body);
}
// ПОЛЬЗОВАТЕЛЬ отображение
return $this->render('order.list-user');
}
}
示例2: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$me = \Auth::user()->load('clients');
$clients = $me->clients->pluck('id');
return \App\Order::whereIn('client_id', $clients)->whereNull('waiter_id')->orderBy('id', 'desc')->get()->load('client', 'items.food');
}
示例3: processreturn
public function processreturn(Request $request)
{
$this->validate($request, ['products' => 'required', 'name' => 'required', 'email' => 'required|email', 'mobile' => 'required|digits:10', 'address' => 'required', 'reason' => 'required']);
$order_ids = $request->get('products');
$orders = Order::whereIn('id', $order_ids)->get();
$user = Sentinel::check();
$user = User::findorfail($user->id);
$return_inputs = ['user_id' => $user->id, 'name' => $request->get('name'), 'email' => $request->get('email'), 'mobile' => $request->get('mobile'), 'address' => $request->get('address'), 'area_id' => $user->area_id, 'reason' => $request->get('reason'), 'status' => 'Booked'];
//dd($return_inputs);
$return = Orderreturn::Create($return_inputs);
if ($return) {
$returns = [];
foreach ($orders as $order) {
array_push($returns, ['order_id' => $order->id, 'return_id' => $return->id]);
}
DB::table('order_return')->insert($returns);
}
$notification = "Sorry! We regret you did not like these products.These products you have selected has been registered for return. Our staff will reach to you and receive those products. Kindly dont not consume the product and make it ready for pickup. Thank you.";
return view('site.notification', compact('notification'));
}