Exemplo n.º 1
0
 public function UpdateListCoupon()
 {
     $input = Input::all();
     $listCouponID = $input['update_list_coupon_id'];
     $listCouponID = explode(",", $listCouponID);
     foreach ($listCouponID as $p) {
         $coupon = Coupon::find($p);
         $coupon->code = $input['code'];
         $coupon->description = $input['description'];
         $coupon->from_date = $input['from_date'];
         $coupon->to_date = $input['to_date'];
         $coupon->save();
     }
 }
Exemplo n.º 2
0
 public function delete_coupon()
 {
     $id = Request::segment(4);
     $coupon = Coupon::find($id);
     Coupon::where('id', $id)->delete();
     $message = "Successfully deleted the coupon";
     $type = "success";
     return Redirect::to('/admin/coupons')->with('type', $type)->with('message', $message);
 }
Exemplo n.º 3
0
 public function postEdit()
 {
     $batch = Input::get('batch') ? 1 : 0;
     if ($batch) {
         $get_all = Coupon::where('batchuniqid', '=', Input::get('batchuniqid'))->get();
         foreach ($get_all as $key => $value) {
             $coup = Coupon::find($value->id);
             $coup->batchuniqid = Input::get('batchuniqid');
             $coup->discount = Input::get('Discount');
             $coup->type = Input::get('Type');
             $coup->parent_id = Input::get('Parent_Id');
             $coup->min_val = Input::get('min_val');
             $coup->expiry = Input::get('Expiry');
             $coup->save();
         }
         Session::flash('message', 'All coupons has been updated sccessfully.');
         return Redirect::to('coupons/viewall');
     } else {
         $coup = Coupon::find(Input::get('id'));
         $coup->batchuniqid = Input::get('batchuniqid');
         $coup->code = Input::get('batchuniqid');
         $coup->discount = Input::get('Discount');
         $coup->type = Input::get('Type');
         $coup->parent_id = Input::get('Parent_Id');
         $coup->expiry = Input::get('Expiry');
         $coup->status = Input::get('Status');
         $coup->min_val = Input::get('min_val');
         $coup->save();
         Session::flash('message', 'Coupon has been updated sccessfully.');
         return Redirect::to('coupons/viewall');
     }
     Session::flash('message', 'Coupon update failed.');
     return Redirect::to('coupons/viewall');
 }