本文整理汇总了PHP中app\models\Order::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::where方法的具体用法?PHP Order::where怎么用?PHP Order::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Order
的用法示例。
在下文中一共展示了Order::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSales
public function getSales()
{
$from = Input::get('from');
$to = Input::get('to');
$all_orders = Order::where(function ($q) use($from, $to) {
if ($from) {
$q->where('created_at', '>=', Carbon::parse($from));
}
if ($to) {
$q->where('created_at', '<=', Carbon::parse($to));
}
})->get();
$paid_orders = Order::where(function ($q) use($from, $to) {
$q->where('state', '1');
if ($from) {
$q->where('created_at', '>=', Carbon::parse($from));
}
if ($to) {
$q->where('created_at', '<=', Carbon::parse($to));
}
})->get();
$total_summ_paid_orders = 0;
foreach ($paid_orders as $order) {
$total_summ_paid_orders += $order->sum;
}
$period = ['from' => $from, 'to' => $to, 'text' => $this->period_text($from, $to)];
return view('admin.stat.sales', ['paid_orders' => $paid_orders, 'orders' => $all_orders, 'total_summ_paid_orders' => number_format($total_summ_paid_orders, 2, ',', ' '), 'period' => $period]);
}
示例2: index
/**
* List all orders.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
// pagination
$session_type = 'order';
if (!$request->session()->has('order_by')) {
$request->session()->put($session_type . '.order_by', 'created_at');
}
if (!$request->session()->has('order_dir')) {
$request->session()->put($session_type . '.order_dir', 'desc');
}
if ($request->order_by) {
$request->session()->put($session_type . '.order_by', $request->order_by);
}
if ($request->order_dir) {
$request->session()->put($session_type . '.order_dir', $request->order_dir);
}
$limit = $request->session()->get('limit');
$orders = Order::where('shop_id', '=', $request->session()->get('shop'))->where(function ($query) use($request) {
if ($request->search) {
return $query->where('id', 'LIKE', '%' . $request->search . '%');
}
})->orderBy($request->session()->get($session_type . '.order_by'), $request->session()->get($session_type . '.order_dir'))->paginate($limit);
$orders->search = $request->search;
return view('admin/orders/index', ['orders' => $orders]);
}
示例3: viewOld
public function viewOld()
{
$error = \Session::get('error');
$messages = \Session::get('messages');
$orders = Order::where('status', '=', Constants::ORDER_VALIDATE)->get();
return view('manager.orderValidated', ['orders' => $orders, 'error' => $error, 'messages' => $messages]);
}
示例4: notify
public function notify(Request $request)
{
\Log::debug('payment_notify', ['request' => $request]);
$input = XML::parse($request->getContent());
if ($input['return_code'] == 'SUCCESS') {
$order = Order::where('wx_out_trade_no', $input['out_trade_no'])->firstOrFail();
$address_id = $order->address_id;
# 当前订单收货地址id
if ($order->isPaid()) {
return 'FAIL';
}
$order->update(['wx_transaction_id' => $input['transaction_id'], 'cash_payment' => floatval($input['total_fee']) / 100.0]);
$order->paid();
/* 发送消息提醒 */
$default_address = Address::where(['id' => $address_id])->first();
$phone = $default_address->phone;
$msg = '尊敬的顾客您好!您的订单已经收到,易康商城将尽快为您安排发货,如有任何问题可以拨打客服电话400-1199-802进行咨询,感谢您的惠顾!';
\MessageSender::sendMessage($phone, $msg);
// if ($phone = env('ORDER_ADMIN_PHONE')) {
// \Log::error($phone);
// \MessageSender::sendMessage($phone, $order->toOrderMessageString());
// }
$result = \Wechat::paymentNotify();
return $result;
}
return 'FAIL';
}
示例5: edit
/**
* Edit a customer.
*
* @param string $id
*
* @return Response
*/
public function edit($id)
{
$customer = User::find($id);
$addresses = Address::where('customer_id', '=', $customer->id)->get();
$orders = Order::where('customer_id', '=', $customer->id)->get();
return view('admin/customers/edit', ['customer' => $customer, 'addresses' => $addresses, 'orders' => $orders]);
}
示例6: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$user = Auth::user();
$firmName = $user->firm->organisation_name;
$countOfOrders = Order::where('user_id', Auth::user()->id)->count();
$countOfDocuments = Document::where('user_id', Auth::user()->id)->count();
return view('cabinet.index', ['p' => 'cabinet', 'userId' => $user->id, 'firmName' => $firmName, 'countOfOrders' => $countOfOrders, 'countOfDocuments' => $countOfDocuments]);
}
示例7: handle
/**
* Handle the event.
*
* @param Purchase $event
* @return void
*/
public function handle(Purchase $event)
{
$customer = $event->customer;
$order = $event->order;
if (is_null(Order::where('customer_id', $customer->id)->where('order_status_id', '>=', 2)->where('id', '!=', $order->id)->first())) {
dispatch(new FirstOrderFeedback($customer));
}
}
示例8: getOrders
public function getOrders($id = null)
{
if ($id) {
//details
return view('order.details', ['products' => OrderProduct::where('order_id', $id)->get(), 'order' => Order::find($id)]);
} else {
return view('order.index', ['orders' => Order::where('user_id', Auth::id())->get()]);
}
}
示例9: handle
/**
* Handle the event.
*
* @param Purchase $event
* @return void
*/
public function handle(Purchase $event)
{
$customer = $event->customer;
$upper = $customer->getReferrer();
$order = $event->order;
if ($upper && is_null(Order::where('customer_id', $customer->id)->where('order_status_id', '>=', 2)->where('id', '!=', $order->id)->first())) {
dispatch(new PatientFirstOrder($upper));
}
}
示例10: success
public function success()
{
$payment = new Payment(config('robokassa.login'), config('robokassa.paymentPassword'), config('robokassa.validationPassword'));
if ($payment->validateResult($_GET)) {
$order = Order::where('id', $payment->getInvoiceId())->first();
if ($payment->getSum() == $order->sum) {
echo 'Успех!';
}
}
}
示例11: getIndex
public function getIndex()
{
$state = Input::get('state');
$orders = Order::where(function ($q) use($state) {
if ($state) {
$q->where('state', '=', $state);
}
})->paginate(15)->appends(Input::except('page'));
return view('admin.orders.index', ['orders' => $orders]);
}
示例12: pastOrders
public function pastOrders()
{
$this->isBoss();
$data = Order::where('order_state', 2)->join('users', 'id_user', '=', 'orders.user_id_user')->paginate(1);
if ($data->isEmpty()) {
return view('layouts.main', ['view' => 'user.noCurOrders', 'header' => 'boss.header', 'nav' => 'boss.nav']);
} else {
return view('layouts.main', ['view' => 'boss.pastOrders', 'header' => 'boss.header', 'nav' => 'boss.nav', 'orders' => $data]);
}
}
示例13: show
/**
* Show the application dashboard.
*
* @return Response
*/
public function show(Request $request)
{
$stats['categories'] = Category::where('shop_id', '=', $request->session()->get('shop'))->count();
$stats['products'] = Product::where('shop_id', '=', $request->session()->get('shop'))->count();
$stats['customers'] = User::where('shop_id', '=', $request->session()->get('shop'))->count();
$stats['pages'] = Page::where('shop_id', '=', $request->session()->get('shop'))->count();
$stats['blogs'] = Blog::where('shop_id', '=', $request->session()->get('shop'))->count();
$stats['orders'] = Order::where('shop_id', '=', $request->session()->get('shop'))->count();
$stats['revenue'] = Order::where('shop_id', '=', $request->session()->get('shop'))->sum('total');
return view('admin/dashboard', ['stats' => $stats]);
}
示例14: logout
public function logout()
{
$connectedUser = Auth::user();
$order = Order::where('user_id', '=', $connectedUser->id)->where('status', '=', Constants::ORDER_IN_PROGRESS)->first();
if ($order) {
$order->status = Constants::ORDER_WAITING;
$order->user_id = Constants::DEFAULT_USER_ID;
$order->save();
}
Auth::logout();
return redirect()->route('auth::viewLogin');
}
示例15: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index(Region $region, TrainRoad $trainRoad, Stantion $stantion)
{
$regionsCount = $region->count();
$tRoadsCount = $trainRoad->count();
$stationsCount = $stantion->count();
$condCount = Condition::count();
$productsCount = Product::count();
$servicesCount = Service::count();
$catCount = Category::count();
$statusesCount = Status::count();
$serviceStatusesCount = ServiceStatus::count();
$newOrdersCount = Order::where('is_new', 1)->count();
$newServiceOrdersCount = ServiceOrder::where('is_new', 1)->count();
$customers = Firm::where('accountant_fio', null)->get();
return view('admin.adminArea', ['regionsCount' => $regionsCount, 'tRoadsCount' => $tRoadsCount, 'stationsCount' => $stationsCount, 'condCount' => $condCount, 'catCount' => $catCount, 'productsCount' => $productsCount, 'servicesCount' => $servicesCount, 'statusesCount' => $statusesCount, 'newOrdersCount' => $newOrdersCount, 'serviceStatusesCount' => $serviceStatusesCount, 'newServiceOrdersCount' => $newServiceOrdersCount, 'customers' => $customers]);
}