本文整理匯總了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'));
}