コード例 #1
0
ファイル: User.php プロジェクト: GoBuyHere/GoBuyHere
 public function bothStores()
 {
     $stores = $this->stores()->with('storeType')->get();
     $nonStores = Store::with('storeType')->get();
     $tmp = $nonStores->diff($stores);
     return array($stores, $tmp);
 }
コード例 #2
0
 public function getStores($time)
 {
     $lastWeek = Carbon::now()->subWeek();
     $lastMonth = Carbon::now()->subMonth();
     if ($time == 'today') {
         $stores = Store::with(['Customers' => function ($query) {
             $query->whereRaw('date(customers.created_at) >= date("' . Carbon::today() . '")');
         }])->whereHas('Customers', function ($q) {
             $q->whereRaw('date(customers.created_at) >= date("' . Carbon::today() . '")');
         })->orderBy('id', 'DESC')->paginate(10);
     } elseif ($time == 'week') {
         $stores = Store::with(['Customers' => function ($query) use($lastWeek) {
             $query->whereRaw('date(customers.created_at) >= date("' . $lastWeek . '")');
         }])->whereHas('Customers', function ($q) use($lastWeek) {
             $q->whereRaw('date(customers.created_at) >= date("' . $lastWeek . '")');
         })->orderBy('id', 'DESC')->paginate(10);
     } elseif ($time == 'month') {
         $stores = Store::with(['Customers' => function ($query) use($lastMonth) {
             $query->whereRaw('date(customers.created_at) >= date("' . $lastMonth . '")');
         }])->whereHas('Customers', function ($q) use($lastMonth) {
             $q->whereRaw('date(customers.created_at) >= date("' . $lastMonth . '")');
         })->orderBy('id', 'DESC')->paginate(10);
     } else {
         $stores = Store::with('customersCount')->orderBy('id', 'DESC')->paginate(10);
     }
     $output = ['stores' => $stores, 'period' => $time];
     return view('admin.stores', $output);
 }
コード例 #3
0
 /**
  * Display a listing of all stores available in the system
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $stores = Store::with('users')->get();
     return view('store.index', compact('stores'));
 }
コード例 #4
0
 public function edit($id)
 {
     $order = Order::with(['details', 'order_express'])->join('order_expresses', 'order_expresses.id', '=', 'orders.id', 'INNER')->whereIn('order_expresses.sid', $this->stores_ids)->find($id);
     if (empty($order)) {
         return $this->failure_noexists();
     }
     if ($order->order_express->express_type == 39) {
         $this->_express_address = UserAddress::find($order->order_express->uaid)->getFullAddressAttribute();
     } else {
         $user_stores = Store::with('user')->find($order->order_express->sid);
         $this->_express_address = $user_stores->name . '-店主:' . $user_stores->user->realname . '-电话:' . $user_stores->phone . '-地址:' . $user_stores->address ?: '无';
     }
     $keys = 'expresses_money';
     $this->_validates = $this->getScriptValidate('order.express', $keys);
     $this->_data = $order;
     return $this->view('agent-backend.order.edit');
 }
コード例 #5
0
 public function all()
 {
     return Store::with('products')->get();
 }
コード例 #6
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $stores = Store::with('account')->with('customer')->with('region')->with('distributor')->with('audittemplate')->with('gradematrix')->get();
     return view('store.index', compact('stores'));
 }