本文整理汇总了PHP中app\Order::newQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::newQuery方法的具体用法?PHP Order::newQuery怎么用?PHP Order::newQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Order
的用法示例。
在下文中一共展示了Order::newQuery方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index(Request $request, $id)
{
//总销售金额
$order = new Order();
$_data['sell_total_money'] = $order->newQuery()->whereRaw('`status`>?', array(1))->sum('total_money');
//总订单数
$_data['order_total_cnt'] = $order->newQuery()->count();
//总商品数
$product = new Product();
$_data['product_total_cnt'] = $product->newQuery()->count();
//总用户数
$user = new User();
$_data['user_total_cnt'] = $user->newQuery()->count();
$this->_week_start = $week_start = date("Y-m-d 00:00:00", strtotime("-" . (date("w") - 1) . " days"));
//本周销售
$_data['sell_week_money'] = $order->newQuery()->whereRaw('created_at>= ? and `status`>?', array($week_start, 1))->sum('total_money');
//本周订单
$_data['order_week_cnt'] = $order->newQuery()->whereRaw('created_at>= ?', array($week_start))->count();
//本周商品
$_data['product_week_cnt'] = $product->newQuery()->whereRaw('created_at>= ?', array($week_start))->count();
//本周用户
$_data['user_week_cnt'] = $user->newQuery()->whereRaw('created_at>= ?', array($week_start))->count();
$this->_data = $_data;
return $this->view('admin.dashboard');
}
示例2: data
public function data(Request $request)
{
$order = new Order();
$builder = $order->newQuery()->with(['order_express'])->where('fid', $this->factory->getKey());
$_builder = clone $builder;
$total = $_builder->count();
unset($_builder);
$data = $this->_getData($request, $builder);
//dd($data);
$data['recordsTotal'] = $total;
$data['recordsFiltered'] = $data['total'];
return $this->success('', FALSE, $data);
}
示例3: export
public function export(Request $request)
{
$order = new Order();
$builder = $order->newQuery()->with('details');
$page = $request->input('page') ?: 0;
$pagesize = $request->input('pagesize') ?: config('site.pagesize.export', 1000);
$total = $this->_getCount($request, $builder);
if (empty($page)) {
$this->_of = $request->input('of');
$this->_table = $order->getTable();
$this->_total = $total;
$this->_pagesize = $pagesize > $total ? $total : $pagesize;
return $this->view('agent-backend.order.export');
}
$data = $this->_getExport($request, $builder);
return $this->success('', FALSE, $data);
}