示例#1
0
 public function getCreate()
 {
     $products = Product::where('active', true)->orderBy('name')->lists('name', 'id');
     $bundles = Bundle::where('active', true)->orderBy('name')->lists('name', 'id');
     $coupons = Coupon::orderBy('code')->lists('code', 'id');
     $pricelists = array();
     $pricelists_get = Pricelist::join('modules', 'modules.id', '=', 'pricelists.module_id')->join('memberships', 'memberships.id', '=', 'pricelists.membership_id')->where('modules.active', true)->orderBy('modules.name')->orderBy('memberships.rank', 'desc')->select('pricelists.*')->get();
     foreach ($pricelists_get as $pricelist) {
         $pricelists[$pricelist->id] = $pricelist->name;
     }
     $payment_statuses = config('redminportal::payment_statuses');
     return view('redminportal::orders/create')->with('products', $products)->with('bundles', $bundles)->with('coupons', $coupons)->with('pricelists', $pricelists)->with('payment_statuses', $payment_statuses);
 }
示例#2
0
 public function getIndex()
 {
     $models = Coupon::orderBy($this->sortBy, $this->orderBy)->paginate($this->perpage);
     $data = ['models' => $models, 'sortBy' => $this->sortBy, 'orderBy' => $this->orderBy];
     return view('redminportal::coupons/view', $data);
 }
 public function getSort($sortBy = 'create_at', $orderBy = 'desc')
 {
     $inputs = array('sortBy' => $sortBy, 'orderBy' => $orderBy);
     $rules = array('sortBy' => 'required|regex:/^[a-zA-Z0-9 _-]*$/', 'orderBy' => 'required|regex:/^[a-zA-Z0-9 _-]*$/');
     $validation = \Validator::make($inputs, $rules);
     if ($validation->fails()) {
         return redirect('admin/coupons')->withErrors($validation);
     }
     if ($orderBy != 'asc' && $orderBy != 'desc') {
         $orderBy = 'asc';
     }
     $coupons = Coupon::orderBy($sortBy, $orderBy)->paginate(20);
     return view('redminportal::coupons/view')->with('coupons', $coupons)->with('sortBy', $sortBy)->with('orderBy', $orderBy);
 }