public function delete($id)
 {
     $voc = Option::where('meta_key', 'voucher')->first();
     $a = unserialize($voc->meta_value);
     unset($a[$id]);
     $reindex = array_values($a);
     $serialize = serialize($reindex);
     Option::where('meta_key', 'voucher')->update(['meta_value' => $serialize]);
     return redirect('master/setting/coupon/')->with('success', 'Voucher berhasil dihapus');
 }
 public function del_bank_account($id)
 {
     $bank_account = Option::where('meta_key', 'bank_account')->first();
     $a = unserialize($bank_account->meta_value);
     unset($a[$id]);
     $reindex = array_values($a);
     $serialize = serialize($reindex);
     $update = Option::where('meta_key', 'bank_account')->update(['meta_value' => $serialize]);
     return redirect('master/setting/bank_account')->with('success', 'Nomor rekening berhasil dihapus');
 }
Exemple #3
0
 public function index()
 {
     $this->data['css_assets'] = Assets::load('css', ['lib-bootstrap', 'style', 'font-awesome', 'font-awesome-min', 'flexslider', 'color-schemes-core', 'color-schemes-turquoise', 'jquery-parallax', 'bootstrap-responsive', 'font-family']);
     $this->data['js_assets'] = Assets::load('js', ['jquery', 'jquery-ui', 'jquery-easing', 'bootstrap-min-lib', 'jquery-isotope', 'jquery-flexslider', 'jquery.elevatezoom', 'jquery-sharrre', 'jquery-gmap3', 'imagesloaded', 'la_boutique', 'jquery-cookie', 'jquery-parallax-lib']);
     $this->data['title'] = 'Home';
     $this->data['category'] = Category::get();
     $this->data['product'] = Product::where('status', 'publish')->orderBy('created_at', 'DESC')->limit(5)->get();
     $this->data['sold'] = Product::where('status', 'publish')->orderBy('sold', 'DESC')->limit(5)->get();
     $this->data['banner'] = Option::where('meta_key', 'banner_home')->first();
     return view('main_layout')->with('data', $this->data)->nest('content', 'home', array('data' => $this->data));
 }
 public function payment_form(Request $request)
 {
     $this->data['css_assets'] = Assets::load('css', ['lib-bootstrap', 'style', 'font-awesome', 'font-awesome-min', 'color-schemes-core', 'color-schemes-turquoise', 'bootstrap-responsive', 'font-family', 'datepicker']);
     $this->data['js_assets'] = Assets::load('js', ['jquery', 'jquery-min', 'jquery-ui', 'bootstrap-min-lib', 'jquery-isotope', 'jquery-flexslider', 'jquery.elevatezoom', 'jquery-sharrre', 'imagesloaded', 'la_boutique', 'jquery-cookie', 'datepicker', 'datepicker-locales']);
     $this->data['title'] = 'Konfirmasi Pembayaran';
     $this->data['bank_account'] = Option::where('meta_key', 'bank_account')->first();
     $this->data['invoice'] = $request->payment;
     if ($this->data['invoice']) {
         $invoice = Order::where('no_invoice', $request->payment)->first();
         $this->data['total_price'] = $invoice->total_price;
     } else {
         $this->data['total_price'] = 0;
     }
     return view('main_layout')->with('data', $this->data)->nest('content', 'payment_confirmation', array('data' => $this->data));
 }
 public function subproduct($slug, $subcategory)
 {
     $this->data['css_assets'] = Assets::load('css', ['lib-bootstrap', 'style', 'font-awesome', 'font-awesome-min', 'flexslider', 'color-schemes-core', 'color-schemes-turquoise', 'jquery-parallax', 'bootstrap-responsive', 'font-family']);
     $this->data['js_assets'] = Assets::load('js', ['jquery', 'jquery-ui', 'jquery-easing', 'bootstrap-min-lib', 'jquery-isotope', 'jquery-flexslider', 'jquery.elevatezoom', 'jquery-sharrre', 'jquery-gmap3', 'imagesloaded', 'la_boutique', 'jquery-cookie', 'jquery-parallax-lib']);
     $this->data['slugcategory'] = Category::where('slug', $slug)->first();
     $this->data['slugsubcategory'] = Subcategory::where('slug', $subcategory)->first();
     //$this->data['banner']		= Option::where('meta_key','banner_'.$slug)->first();
     //$this->data['title']		= $this->data['slugsubcategory']->name;
     if ($this->data['slugcategory'] == NULL || $this->data['slugsubcategory'] == NULL) {
         $this->data['title'] = '404 - not found';
         $this->data['message'] = 'Subcategory that you looking for is not found or has been removed';
         return view('main_layout')->with('data', $this->data)->nest('content', 'error/404_product', array('data' => $this->data));
     } else {
         $this->data['banner'] = Option::where('meta_key', 'banner_' . $slug)->first();
         $this->data['title'] = ucwords($this->data['slugcategory']->name) . ' - ' . $this->data['slugsubcategory']->subname;
         return view('main_layout')->with('data', $this->data)->nest('content', 'product/product', array('data' => $this->data));
     }
 }
Exemple #6
0
 public function sendEmailAdmin($data)
 {
     $from_name = 'Covanti';
     $admin_email = Option::where('meta_key', '=', 'admin_email')->first();
     $from = $admin_email->meta_value;
     $to = $admin_email->meta_value;
     $subject = 'Pesan dari Kontak Kami';
     $data = $data;
     $body = view('emails/contactus', $data);
     $this->send($from_name, $from, $to, $subject, $body);
 }
 public function insert_category_banner(Request $request)
 {
     $banner = Option::where('meta_key', 'banner_' . $request->submit)->first();
     $unserialize = unserialize($banner->meta_value);
     $key = $request->key;
     $file = Input::file('images');
     $rules = array('file' => 'mimes:jpeg,jpg,png|required');
     //'required|mimes:png,gif,jpeg,txt,pdf,doc'
     $validator = Validator::make(array('file' => $file), $rules);
     if ($validator->passes()) {
         $img = Image::make($file);
         if ($key == 'banner1') {
             $filename = $request->submit . '_' . $key . '.jpg';
             $img->resize(1170, 300);
             $unserialize[$key] = $filename;
         } else {
             $filename = $request->submit . '_' . $key . '.jpg';
             $img->resize(480, 180);
             $unserialize[$key] = $filename;
         }
         $img->save(storage_path('photo_banner/' . $filename), 50);
     } else {
         return redirect('banner_list')->with('fail', 'Banner gagal ditambahkan');
     }
     $serialize = serialize($unserialize);
     $banner->meta_value = $serialize;
     $banner->save();
     return redirect('banner_list')->with('success', 'Banner berhasil ditambahkan');
 }
 public function discount(Request $request)
 {
     $total = Cart::total();
     $voucher = Option::where('meta_key', 'voucher')->first()->meta_value;
     $coupon = unserialize($voucher);
     foreach ($coupon as $value) {
         if ($value['code'] == $request->coupon) {
             $code = $value;
         } else {
             return redirect('keranjang')->with('fail', "Kode Voucher tidak terdaftar");
         }
     }
     $begin_date = date_create($code['[beginDate]']);
     $date = date_create($code['endDate']);
     $day = date_create(date("Y-m-d"));
     if ($day <= $date && $day >= $begin_date) {
         $disc = $total * $code['discount'] / 100;
         if ($disc > $code['maxDiscount']) {
             $disc = $code['maxDiscount'];
         }
         return redirect('keranjang')->with('discount', $disc)->with('coupon', $request->coupon);
     } else {
         return redirect('keranjang')->with('fail', "Kode Voucher tidak berlaku");
     }
 }