public function login() { Session::set('admin_lock_url', null); $loginForm = new KForm(); $loginForm->addField(FormFieldBase::createByType('login', FormFieldBase::Type_Text)->setRules('required')->setLabel('请输入工号')); $loginForm->addField(FormFieldBase::createByType('password', FormFieldBase::Type_Password)->setRules('required')->setLabel('请输入密码')); if (AuthModel::user() !== null) { return Redirect::action('admin.index'); } if (Request::isMethod('POST')) { //是管理员登陆请求 if ($loginForm->validation()) { $login = $loginForm->value('login'); $password = $loginForm->value('password'); if (AuthModel::attempt(['employee_id' => $login, 'password' => $password])) { $admin = AuthModel::getUser(); $admin->last_login = new \Carbon\Carbon(); $admin->save(); return Redirect::action('admin.index'); } else { $loginForm->set_error('password', '错误的用户名或密码'); } } else { // } } $this->layout = View::make('laravel-cms::admin-lte/login')->with('form', $loginForm); }
public function contactUs() { $member1 = Session::get('brand_userid'); $member2 = Session::get('member_userid'); if (!empty($member1)) { $memberdetail = Brandmember::find($member1); } elseif (!empty($member2)) { $memberdetail = Brandmember::find($member2); } else { $memberdetail = (object) array("email" => "", "fname" => "", "lname" => ""); } if (Request::isMethod('post')) { $user_name = Request::input('contact_name'); $user_email = Request::input('contact_email'); $subject = Request::input('contact_subject'); $cmessage = Request::input('message'); $setting = DB::table('sitesettings')->where('name', 'email')->first(); $admin_users_email = $setting->value; $sent = Mail::send('frontend.cms.contactemail', array('name' => $user_name, 'email' => $user_email, 'messages' => $cmessage), function ($message) use($admin_users_email, $user_email, $user_name) { $message->from($admin_users_email); $message->to($user_email, $user_name)->cc($admin_users_email)->subject(Request::input('contact_subject')); }); if (!$sent) { Session::flash('error', 'something went wrong!! Mail not sent.'); return redirect('contact-us'); } else { Session::flash('success', 'Message is sent to admin successfully. We will getback to you shortly'); return redirect('contact-us'); } } return view('frontend.cms.contactus', compact('memberdetail'), array('title' => 'Miramix - Contact Us')); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(LoginAndRegisterFormRequest $request) { if (Request::isMethod('post')) { User::create(['name' => Request::get('name'), 'email' => Request::get('email'), 'password' => bcrypt(Request::get('password'))]); } return Redirect::to('/auth/login')->with('successfullyRegistered', 'Konto utworzone. Zaloguj się.'); }
/** Method to get information about the logged in user @param void @return view */ public function userList() { if (!Auth::check()) { return Redirect::to('/'); } $message = ''; if (Request::isMethod('post')) { $data = Input::except('_token'); $password = Hash::make(Input::get('password')); $user = new User(); $user->name = Input::get('name'); $user->email = Input::get('email'); $user->password = $password; $username = Input::get('name'); $userEmail = Input::get('email'); if ($user->save()) { try { Mail::send('emails.welcome', ['userEmail' => $username], function ($m) use($userEmail, $username) { $m->to($userEmail, $username)->subject('Express Rental'); }); } catch (Exception $ex) { } $message = 'Added Successfully'; return Redirect::to('/users/list')->with('message', $message); } else { $message = 'Addition not Successfully'; return Redirect::to('/users/list')->withErrors('message', $message); } } else { $allUserInfo = DB::table('users')->orderBy('users.id', 'DESC')->paginate(5); return view('Home.list')->with(compact('allUserInfo')); } }
public function register() { if (Request::isMethod('post')) { User::create(['name' => Request::get('name'), 'email' => Request::get('email'), 'password' => bcrypt(Request::get('password'))]); } return Redirect::intended('/'); }
public function loginAction() { $this->layout = null; $user = Sentinel::getUser(); if ($user && !$this->checkRole()) { return Redirect::route('indexDashboard'); } if (Request::isMethod('post')) { $this->data['status'] = false; $this->data['message'] = ""; $this->checkLogin($this->data); if ($this->data['status'] === true) { if (session_id() == '') { @session_start(); } // set session for ckeditor $_SESSION['isLoggedIn'] = true; $defaultPageConfig = config('trungtnm.backend.default_page_route'); try { $redirectUrl = route($defaultPageConfig); } catch (InvalidArgumentException $e) { $redirectUrl = url($defaultPageConfig); } return redirect($redirectUrl); } } return view('TrungtnmBackend::login', $this->data); }
public function cart() { if (Request::isMethod('post')) { $this->cartAdd(); } if (Request::get('product_id')) { $this->CartProductAmount(); } $cart = Cart::content(); return view('cart')->with('cart', $cart); }
public function login() { $title = Lang::get('auth::login.title'); if (Request::isMethod('POST')) { if (Auth::attempt(array('email' => Input::get('email'), 'password' => Input::get('password'), 'activated' => 1, 'suspended' => 0), Input::has('remember'))) { return Redirect::intended(Config::get('auth::login.redirect')); } return Redirect::back()->with('attempt', false)->withInput(); } return View::make(Config::get('auth::login.view'), compact('title')); }
/** * Send output or error. * * @param $output * @param $code * @return mixed */ public static function response($output, $code) { if (Request::isMethod('get') && strpos(Request::route()->getName(), 'index') !== false) { return Response::json($output, $code); } if (empty($output) || collect($output)->isEmpty()) { if ($code === 304) { return Response::json($output, $code); } return Response::json(self::error(64), 404); } if ($output === false or $output === 0) { return Response::json(self::error(64), 404); } return Response::json($output, $code); }
public function memberDelete(Request $request) { $id = (int) Request::segment(3); $action = Request::segment(4); if (Request::isMethod('get')) { $validator = Validator::make(Input::all(), User::$memberDeleteRules); if ($validator->passes()) { if (User::deleteMember($id)) { return Redirect::to('users/members')->with('message', 'The following errors occurred')->withErrors('Delete successfully')->with('flag', 'success'); } else { return Redirect::to('users/member/' . $id . '/update')->with('message', 'The following errors occurred')->withErrors('Delete failed')->with('flag', 'danger'); } } else { return Redirect::to('users/member/' . $id . '/update')->with('message', 'The following errors occurred')->withErrors($validator)->withInput()->with('flag', 'danger'); } } }
public function reply($login, $repo, $issue) { $data = ['success' => 0]; if (Request::isMethod('post')) { $body = trim(Input::get('reply')); if ($body) { try { GitHub::issue()->comments()->create($login, $repo, $issue, ['body' => $body]); $data['success'] = 1; } catch (RuntimeException $exception) { $data['error'] = $exception->getMessage(); } } } $response = Response::make(json_encode($data), 200); $response->header('Content-Type', 'application/json'); return $response; }
public function uploadCsv(Request $request) { if (Request::isMethod('post')) { $validator = Validator::make(Input::all(), AdminTool::$uploadCsvRules); if ($validator->passes()) { $file = \Request::file('yourcsv'); //the files are stored in storage/app/*files* $output = Storage::put('yourcsv.csv', file_get_contents($file)); if ($output) { $this->dispatch(new ImportCSV()); return Redirect::to('admin/uploadcsv')->with('message', 'The following errors occurred')->withErrors('Your file has been successfully uploaded. You will receive an email notification once the import is completed.'); } else { return Redirect::to('admin/uploadcsv')->with('message', 'The following errors occurred')->withErrors('Something went wrong with your upload. Please try again.'); } } else { return Redirect::to('admin/uploadcsv')->with('message', 'The following errors occurred')->withErrors($validator)->withInput(); } } return view('admin/uploadcsv'); }
/** * Display a listing of the resource. * * @return Response */ public function inventory() { $member1 = Session::get('brand_userid'); if (!empty($member1)) { $memberdetail = Brandmember::find($member1); } else { $memberdetail = (object) array("email" => "", "fname" => "", "lname" => ""); } if (Request::isMethod('post')) { $name = Request::input('name'); $ingradient_name = Request::input('ingradient_name'); $user_email = Request::input('contact_email'); $subject = 'Request for ingredient'; $cmessage = Request::input('request_ing'); $setting = DB::table('sitesettings')->where('name', 'email')->first(); $admin_users_email = $setting->value; $sent = Mail::send('frontend.inventory.ingredientemail', array('admin_users_email' => $admin_users_email, 'name' => $name, 'ingradient_name' => $ingradient_name, 'email' => $user_email, 'messages' => $cmessage), function ($message) use($admin_users_email, $user_email, $ingradient_name, $subject) { $message->from($admin_users_email); $message->to($user_email, $ingradient_name)->cc($admin_users_email)->subject($subject); }); if (!$sent) { Session::flash('error', 'something went wrong!! Mail not sent.'); return redirect('inventory'); } else { Session::flash('success', 'Message is sent to admin successfully. We will getback to you shortly'); return redirect('inventory'); } } $start = 'a'; $end = 'z'; $pageindex = array(); for ($i = $start; $i < $end; $i++) { $inv = DB::table('ingredients')->whereRaw(" name like '" . $i . "%'")->orderBy('name', 'ASC')->get(); $pageindex[$i] = $inv; } $inv = DB::table('ingredients')->whereRaw(" name like 'z%'")->orderBy('name', 'ASC')->get(); $pageindex['z'] = $inv; return view('frontend.inventory.inventory', compact('pageindex', 'memberdetail'), array('title' => 'Miramix Inventory')); }
public function anyBooking() { $error_msg = []; $success_msg = []; $service_types = ServiceTypes::all(); if (Request::isMethod('POST')) { $rules = ['first_name' => 'required', 'last_name' => 'required', 'email' => 'required', 'phone' => 'required', 'address' => 'required', 'suburb' => 'required', 'city' => 'required', 'booking_date' => 'required', 'service_type_id' => 'required']; $validator = Validator::make(Input::all(), $rules); if (!$validator->fails()) { $booking_date = Input::get('booking_date'); $user_booking_count = Bookings::where('user_id', User::get()->id)->where('pending', 1)->where('booking_date', date('Y-m-d', strtotime($booking_date)))->count(); if ($user_booking_count >= 1) { $error_msg[] = 'Sorry. Our system shows you have a pending booking. We are currently processing your service booking and will contact you within 48 hours.'; } else { $booking = new Bookings(Input::all()); $booking->uid = Uuid::generate()->string; $booking->user_id = User::get()->id; $booking->pending = 1; $booking->booking_date = date('Y-m-d', strtotime(Input::get('booking_date'))); $booking->save(); if ($booking) { $success_msg[] = 'Great! We have received your service booking. You should be able to hear from us in the next 48 hours.'; } else { $error_msg[] = 'Whoops! There was an error in your booking. Please try again.'; } } } else { return Redirect::back()->withErrors($validator->messages())->withInput(Input::all()); } } if (User::check()) { return View::make('booking.booking', ['user' => User::get(), 'service_types' => $service_types, 'error_msg' => $error_msg, 'success_msg' => $success_msg]); } else { return Redirect::to('/user/login'); } }
public function uploadImage(Request $request) { $data = null; if (Request::isMethod('post')) { $validator = Validator::make(Input::all(), AdminTool::$uploadImageRules); if ($validator->passes()) { $file = \Request::file('yourfile'); //the files are stored in storage/app/*files* $output = Storage::put('yourfile.png', file_get_contents($file)); $cloudinary = ImageManagement::uploader($file); echo cl_image_tag($cloudinary['url'], array("alt" => "Sample Image")); echo "<hr />"; dd($cloudinary); if ($cloudinary) { return Redirect::to('admin/playground')->with('data', $cloudinary)->with('message', 'The following errors occurred')->withErrors('Your image has uploaded by using Cloudinary.'); } else { return Redirect::to('admin/playground')->with('message', 'The following errors occurred')->withErrors('Something went wrong with your upload. Please try again.'); } } else { return Redirect::to('admin/playground')->with('message', 'The following errors occurred')->withErrors($validator)->withInput(); } } return view('admin/testupload', compact($data)); }
protected function sniffAction() { if (Request::isMethod('post') && $this->url->value('process')) { $this->action = $this->status == "modify" ? "update" : "insert"; } }
public function success() { if (Session::has('coupon_code')) { Session::forget('coupon_code'); } elseif (Session::has('coupon_type')) { Session::forget('coupon_type'); } elseif (Session::has('coupon_discount')) { Session::forget('coupon_discount'); } elseif (Session::has('coupon_amount')) { Session::forget('coupon_amount'); } //SuccessFull payment View $xsrfToken = app('Illuminate\\Encryption\\Encrypter')->encrypt(csrf_token()); // For Paypal Payment Only // $sitesettings = DB::table('sitesettings')->get(); $all_sitesetting = array(); foreach ($sitesettings as $each_sitesetting) { $all_sitesetting[$each_sitesetting->name] = $each_sitesetting->value; } $admin_users_email = $all_sitesetting['email']; // Admin Support Email $payment_method = $all_sitesetting['payment_mode']; if (Session::get('payment_method') == 'paypal') { if (Request::isMethod('post')) { $custom = explode(',', $_POST['custom']); //Return From Paypal $user_id = $custom[0]; //User_id $order_id = $custom[1]; //Order_id $order = DB::table('orders')->where('id', $order_id)->first(); $status = $order->order_status; if ($status == 'pending') { $transaction_status = $_POST['payment_status']; $update_order = DB::table('orders')->where('id', $order_id)->update(['order_status' => 'processing', 'transaction_id' => $_POST['txn_id'], 'transaction_status' => $transaction_status]); /* Order details for perticular order id */ $order_list = DB::table('orders')->leftJoin('order_items', 'order_items.order_id', '=', 'orders.id')->select('orders.*', 'order_items.brand_id', 'order_items.brand_name', 'order_items.brand_email', 'order_items.product_id', 'order_items.product_name', 'order_items.product_image', 'order_items.quantity', 'order_items.price', 'order_items.form_factor_id', 'order_items.form_factor_name')->where('orders.id', '=', $order_id)->get(); Session::put('order_number', $order_list[0]->order_number); Session::put('order_id', $order_id); if (Session::has('member_userid')) { $user_details = DB::table('brandmembers')->where('id', Session::get('member_userid'))->first(); $name = $user_details->fname . ' ' . $user_details->lname; $username = $user_details->username; if ($name != '') { $mailing_name = $name; } else { $mailing_name = $username; } $user_email = $user_details->email; } else { //for guest checkout $guestdata = Session::get('guest_array'); $name = $guestdata["guest_fname"] . ' ' . $guestdata["guest_lname"]; $username = Session::get('guest_username_sess'); $mailing_name = $name; $user_email = $guestdata["guest_email"]; } /* Mail For Member */ $sent = Mail::send('frontend.checkout.order_details_mail', array('admin_users_email' => $admin_users_email, 'receiver_name' => $mailing_name, 'email' => $user_email, 'order_list' => $order_list), function ($message) use($admin_users_email, $user_email, $mailing_name) { $message->from($admin_users_email); //support mail $message->to($user_email, $mailing_name)->subject('Miramix Order Details'); }); /* Mail For Brand */ /*$branduser = array(); foreach($order_list as $each_order_list) { $branduser[$each_order_list->brand_email]=$each_order_list->brand_name; } $brandusers=array_unique($branduser); foreach($brandusers as $brand_email=>$brand_name) { $items=array(); foreach($order_list as $each_order_list) { if($each_order_list->brand_email!=$brand_email) continue; $items[]=$each_order_list; } $sent_brand = Mail::send('frontend.checkout.brand_order_details_mail', array('admin_users_email'=>$admin_users_email,'brand_name'=>$brand_name,'brand_email'=>$brand_email,'order_list'=>$items), function($message) use ($admin_users_email, $brand_email,$brand_name) { $message->from($admin_users_email); //support mail $message->to($brand_email, $brand_name)->subject('Miramix Order Details For Brand'); }); }*/ /* Mail For Admin */ $admin_user = DB::table('users')->first(); $admin_email = $admin_user->email; if ($admin_user->name != '') { $admin_name = $admin_user->name; } else { $admin_name = 'Admin'; } $sent_admin = Mail::send('frontend.checkout.admin_order_details_mail', array('admin_users_email' => $admin_users_email, 'receiver_name' => $admin_name, 'admin_email' => $admin_email, 'order_list' => $order_list), function ($message) use($admin_users_email, $admin_email, $admin_name) { $message->from($admin_users_email); //support mail $message->to($admin_email, $admin_name)->subject('Miramix Order Details For Admin'); }); if (!$sent) { Session::flash('error', 'something went wrong!! Mail not sent.'); //return redirect('member-forgot-password'); } else { Session::flash('success', 'Your order successfully placed.'); //return redirect('memberLogin'); } } } } /* ========================= Remove session ==================================== */ Session::forget('payment_method'); Session::forget('step3'); Session::forget('step1'); Session::forget('guest_array'); Session::forget('guest'); Session::forget('coupon_code'); Session::forget('coupon_type'); Session::forget('coupon_discount'); /* ========================= End Remove session ==================================== */ return view('frontend.checkout.pyament_success', array('title' => 'MIRAMIX | Checkout-Success'))->with('xsrf_token', $xsrfToken); }
protected function isGet() { return Request::isMethod('get'); }
public function register() { if (Request::isMethod('post')) { User::create(array('name' => Request::get('name'), 'email' => Request::get('email'), 'password' => bcrypt(Request::get('password')))); } return Redirect::away('login'); }
public function rateProduct($product_id = '') { if (!$this->obj->checkMemberLogin()) { return redirect('memberLogin'); } if ($product_id == '') { Session::flash('error', 'Please select valid product.'); return redirect('member-dashboard'); } $member2 = Session::get('member_userid'); if (!empty($member2)) { $memberdetail = DB::table('brandmembers')->where("id", $member2)->first(); } $rating_details = DB::table('product_rating')->where('product_id', $product_id)->where("user_id", $memberdetail->id)->first(); if (count($rating_details) > 0) { Session::flash('error', 'You have already rated for this product.'); return redirect('order-history'); } if (Request::isMethod('post')) { $ratedata = array("product_id" => Request::input('product_id'), "user_id" => $member2, "username" => $memberdetail->username, "rating_value" => Request::input('rating_val'), "rating_title" => Request::input('review_title'), "comment" => Request::input('message'), "created_on" => date('Y-m-d H:i:s')); DB::table('product_rating')->insert($ratedata); Session::flash('success', 'You have rated successfully for this product.'); return redirect('order-history'); } $product = DB::table('products')->where('id', $product_id)->first(); return view('frontend.order.member_rating', compact('product', 'memberdetail'), array('title' => 'MIRAMIX | Rate Product')); }
/** * detect current action to execute by request method and qs * if needed it find the record for update/do_delete "action" */ protected function sniffAction() { ///// insert ///// if (Request::isMethod('post') && $this->url->value('insert' . $this->cid)) { $this->action = "insert"; ///// update ///// } elseif (Request::isMethod('patch') && $this->url->value('update' . $this->cid)) { $this->action = "update"; $this->process_url = $this->url->append('update', $this->url->value('update' . $this->cid))->get(); if (!$this->find($this->url->value('update' . $this->cid))) { $this->status = "unknow_record"; } ///// delete ///// } elseif (Request::isMethod('delete') && $this->url->value("do_delete" . $this->cid)) { $this->action = "delete"; if (!$this->find($this->url->value("do_delete" . $this->cid))) { $this->status = "unknow_record"; } } }
public function changePass() { if (Request::isMethod('post')) { $old_password = Request::input('old_password'); $password = Request::input('password'); $conf_pass = Request::input('conf_pass'); // Get Admin's password $user = User::find(Auth::id()); if (Hash::check($old_password, $user['password'])) { if ($password != $conf_pass) { Session::flash('error', 'Password and confirm password is not matched.'); return redirect('admin/change-password'); } else { DB::table('users')->where('id', Auth::id())->update(array('password' => Hash::make($password))); Session::flash('success', 'Password successfully changed.'); return redirect('admin/change-password'); } } else { Session::flash('error', 'Old Password does not match.'); return redirect('admin/change-password'); } } return view('admin.home.changepassword', array('title' => 'Change Password', 'module_head' => 'Change Password')); }
public function filters() { $limit = 10; $orderstatus = Request::input('orderstatus'); $filterdate = Request::input('filterdate'); $brandemail = Request::input('brandemail'); if ($orderstatus == '0') { $orderstatus = ''; if (Request::isMethod('post')) { Session::forget('orderstatus'); } } if ($filterdate == '') { $filterdate = ''; if (Request::isMethod('post')) { Session::forget('filterdate'); } } if ($brandemail == '') { $brandemail = ''; if (Request::isMethod('post')) { Session::forget('brandemail'); } } //echo $filterdate; exit; if (Request::isMethod('post')) { if ($orderstatus != '0') { Session::put('orderstatus', $orderstatus); } if ($filterdate != '') { Session::put('filterdate', $filterdate); } if ($brandemail != '') { Session::put('brandemail', $brandemail); } } // $order_list = Order::with('getOrderMembers','AllOrderItems')->orderBy('id','DESC'); $order_list = DB::table('orders')->select(DB::raw('orders.*'))->leftJoin('order_items', 'orders.id', '=', 'order_items.order_id')->leftJoin('brandmembers', 'order_items.brand_id', '=', 'brandmembers.id')->orderBy('id', 'DESC'); $orderstatus = Session::get('orderstatus'); $filterdate = Session::get('filterdate'); $brandemail = Session::get('brandemail'); if (($orderstatus == '' || $orderstatus == '0') && $filterdate == '' && $brandemail == '') { Session::forget('orderstatus'); return redirect('/admin/orders'); } if ($orderstatus != '0' && $orderstatus != '') { $order_list->whereRaw("orders.order_status='" . $orderstatus . "'"); } if ($filterdate != '') { $order_list->whereRaw("DATE(orders.created_at)='" . $filterdate . "'"); } if ($brandemail != '') { $order_list->whereRaw("(brandmembers.email='" . $brandemail . "' or brandmembers.business_name like '%" . $brandemail . "%')"); } $order_list = $order_list->paginate($limit); //print_r($order_list);exit; $order_list->setPath(''); if ($orderstatus == '0') { Session::forget('orderstatus'); Session::forget('filterdate'); Session::forget('brandemail'); return redirect('/admin/orders'); } return view('admin.order.order_history', compact('order_list', 'orderstatus', 'filterdate', 'brandemail'), array('title' => 'MIRAMIX | All Order', 'module_head' => 'Orders')); }
public function checkoutStep4() { $obj = new helpers(); if ($obj->checkMemberLogin() && !$obj->checkBrandLogin()) { $sitesettings = DB::table('sitesettings')->get(); if (!empty($sitesettings)) { foreach ($sitesettings as $each_sitesetting) { if ($each_sitesetting->name == 'shipping_rate') { $shipping_rate = (int) $each_sitesetting->value; } } } if (Request::isMethod('post')) { $shp_address = DB::table('addresses')->where('mem_brand_id', Session::get('member_userid'))->where('id', Session::get('selected_address_id'))->first(); // Serialize the Shipping Address because If user delete there address from "addresses" table,After that the address also store in the "order" table for getting order history// $shiping_address = array('address_title' => $shp_address->address_title, 'mem_brand_id' => $shp_address->mem_brand_id, 'first_name' => $shp_address->first_name, 'last_name' => $shp_address->last_name, 'email' => $shp_address->email, 'phone' => $shp_address->phone, 'address' => $shp_address->address, 'address2' => $shp_address->address2, 'city' => $shp_address->city, 'zone_id' => $shp_address->zone_id, 'country_id' => $shp_address->country_id, 'postcode' => $shp_address->postcode); $shiping_address_serial = serialize($shiping_address); $order = Order::create(['order_total' => Request::input('grand_total'), 'sub_total' => Request::input('sub_total'), 'order_status' => 'pending', 'shipping_address_id' => Session::get('selected_address_id'), 'shipping_cost' => $shipping_rate, 'shipping_type' => 'flat', 'user_id' => Session::get('member_userid'), 'ip_address' => $_SERVER['REMOTE_ADDR'], 'payment_method' => Session::get('payment_method'), 'transaction_id' => '', 'transaction_status' => '', 'shiping_address_serialize' => $shiping_address_serial, 'created_at' => date('Y-m-d H:s:i'), 'updated_at' => date('Y-m-d H:s:i')]); $last_order_id = $order->id; $allCart = DB::table('carts')->where('user_id', Session::get('member_userid'))->get(); foreach ($allCart as $eachCart) { $product_details = DB::table('products')->where('id', $eachCart->product_id)->first(); // echo $each_content->brandmember_id; exit; $brandmember_deatils = DB::table('products')->leftJoin('brandmembers', 'brandmembers.id', '=', 'products.brandmember_id')->select('products.*', 'brandmembers.fname', 'brandmembers.lname', 'brandmembers.username', 'brandmembers.slug', 'brandmembers.pro_image', 'brandmembers.brand_details', 'brandmembers.brand_sitelink', 'brandmembers.status', 'brandmembers.admin_status')->where('products.id', '=', $eachCart->product_id)->first(); //echo "<pre>";print_r($brandmember_deatils); exit; //echo $brandmember->slug ; exit; $brand_member_name = $brandmember_deatils->fname ? $brandmember_deatils->fname . ' ' . $brandmember_deatils->lname : $brandmember_deatils->username; $formfactor = DB::table('form_factors')->where('id', '=', $eachCart->form_factor)->first(); $order_item = OrderItems::create(['order_id' => $last_order_id, 'brand_id' => $brandmember_deatils->brandmember_id, 'brand_name' => $brand_member_name, 'product_id' => $eachCart->product_id, 'product_name' => $eachCart->product_name, 'product_image' => $product_details->image1, 'quantity' => $eachCart->quantity, 'price' => $eachCart->amount, 'form_factor_id' => $formfactor->id, 'form_factor_name' => $formfactor->name]); // All Cart deleted from cart table after inserting all data to order and order_item table. //$deleteCart = Cart::where('user_id', '=', Session::get('member_userid'))->delete(); } if (Session::get('payment_method') == 'creditcard') { return redirect('/checkout-authorize/' . $last_order_id); } elseif (Session::get('payment_method') == 'paypal') { return redirect('/checkout-paypal/' . $last_order_id); } } // All Cart Contain In Session Will Display Here // $content = DB::table('carts')->where('user_id', Session::get('member_userid'))->get(); //echo "<pre>";print_r($content); exit; foreach ($content as $each_content) { $product_res = DB::table('products')->where('id', $each_content->product_id)->first(); // echo $each_content->brandmember_id; exit; $brandmember = DB::table('products')->leftJoin('brandmembers', 'brandmembers.id', '=', 'products.brandmember_id')->select('products.*', 'brandmembers.fname', 'brandmembers.lname', 'brandmembers.username', 'brandmembers.slug', 'brandmembers.pro_image', 'brandmembers.brand_details', 'brandmembers.brand_sitelink', 'brandmembers.status', 'brandmembers.admin_status')->where('products.id', '=', $each_content->product_id)->first(); //echo "<pre>";print_r($brandmember); //echo $brandmember->slug ; exit; $brand_name = $brandmember->fname ? $brandmember->fname . ' ' . $brandmember->lname : $brandmember->username; $formfactor = DB::table('form_factors')->where('id', '=', $each_content->form_factor)->first(); $formfactor_name = $formfactor->name; $formfactor_id = $formfactor->id; $cart_result[] = array('rowid' => $each_content->row_id, 'product_name' => $each_content->product_name, 'product_slug' => $brandmember->product_slug, 'product_image' => $product_res->image1, 'qty' => $each_content->quantity, 'price' => $each_content->amount, 'duration' => $each_content->duration, 'formfactor_name' => $formfactor_name, 'formfactor_id' => $formfactor_id, 'brand_name' => $brand_name, 'brand_slug' => $brandmember->slug, 'subtotal' => $each_content->sub_total); } //echo "sph= ".$shipping_rate; exit; return view('frontend.checkout.checkout_setp4', compact('body_class', 'cart_result', 'shipping_rate'), array('title' => 'MIRAMIX | Checkout-Step4')); } else { redirect('/checkout-step1'); } }
public function cart() { //update/ add new item to cart if (Request::isMethod('post')) { $product_id = Request::get('product_id'); $product = Product::find($product_id); Cart::add(array('id' => $product_id, 'name' => $product->name, 'qty' => 1, 'price' => $product->price)); } //increment the quantity if (Request::get('product_id') && Request::get('increment') == 1) { $rowId = Cart::search(array('id' => Request::get('product_id'))); $item = Cart::get($rowId[0]); Cart::update($rowId[0], $item->qty + 1); } //decrease the quantity if (Request::get('product_id') && Request::get('decrease') == 1) { $rowId = Cart::search(array('id' => Request::get('product_id'))); $item = Cart::get($rowId[0]); Cart::update($rowId[0], $item->qty - 1); } $cart = Cart::content(); return view('cart', array('cart' => $cart, 'title' => 'Welcome', 'description' => '', 'page' => 'home')); }
public function index() { $units = DafUnitStaff::all(); if (Request::isMethod('post')) { // create the validation rules ------------------------ $rules = array('unit' => 'required'); // validate against the inputs from our form $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { // get the error messages from the validator $messages = $validator->messages(); // redirect our user back to the form with the errors from the validator return Redirect::back()->withErrors($messages); } else { $unit = DafUnitStaff::where('unit_staf_id', Input::get('unit'))->first(); $softProfiles = CompetencyProfile::with('competencyDictionary')->join('competency_dictionaries', 'competency_profiles.competency_dictionary_id', '=', 'competency_dictionaries.id')->where('competency_dictionaries.type_id', '=', '1')->where('jabatan_id', '=', Input::get('unit'))->groupBy('competency_dictionary_id')->get(); $hardProfiles = CompetencyProfile::with('competencyDictionary')->join('competency_dictionaries', 'competency_profiles.competency_dictionary_id', '=', 'competency_dictionaries.id')->where('competency_dictionaries.type_id', '=', '2')->where('jabatan_id', '=', Input::get('unit'))->groupBy('competency_dictionary_id')->get(); // return $profiles; $this->layout->content = View::make('competency::profile.postindex', compact('units', 'unit', 'softProfiles', 'hardProfiles')); } } else { $this->layout->content = View::make('competency::profile.index', compact('units')); } }
public function editMemberShippingAddress() { $obj = new helpers(); if (!$obj->checkMemberLogin()) { return redirect('memberLogin'); } $id = Request::input('id'); if (empty($id)) { return redirect('member-shipping-address'); } $country = DB::table('countries')->orderBy('name', 'ASC')->get(); $alldata = array(); foreach ($country as $key => $value) { $alldata[$value->country_id] = $value->name; } if (Request::isMethod('post')) { $address = array(); $address['mem_brand_id'] = Session::get('member_userid'); $address['first_name'] = Request::input('first_name'); $address['last_name'] = Request::input('last_name'); $address['address'] = Request::input('address'); $address['address2'] = Request::input('address2'); $address['country_id'] = Request::input('country'); $address['zone_id'] = Request::input('zone_id'); // State id $address['city'] = Request::input('city'); $address['postcode'] = Request::input('postcode'); $address['phone'] = Request::input('phone'); $address['email'] = Request::input('email'); DB::table('addresses')->where('id', Request::input('id'))->update($address); if (Request::input('default_address') == '1') { $addressId = Request::input('id'); $dataUpdateAddress = DB::table('brandmembers')->where('id', Session::get('member_userid'))->update(['address' => $addressId]); } Session::flash('success', 'Shipping Address successfully updated.'); return redirect('member-shipping-address'); } $address = DB::table('addresses')->find($id); $states = DB::table('zones')->where('country_id', $address->country_id)->orderBy('name', 'ASC')->get(); $allstates = array(); foreach ($states as $key => $value) { $allstates[$value->zone_id] = $value->name; } $member_details = Brandmember::find(Session::get('member_userid')); $total_add = DB::table('addresses')->where('mem_brand_id', Session::get('member_userid'))->where('id', '!=', $id)->count(); return view('frontend.member.edit_member_shipping', compact('alldata', 'address', 'allstates', 'member_details', 'total_add'), array('title' => 'Edit Shipping Address')); }
public function brandRegister() { $obj = new helpers(); if ($obj->checkUserLogin()) { return redirect('home'); } $country = DB::table('countries')->orderBy('name', 'ASC')->get(); $alldata = array(); foreach ($country as $key => $value) { $alldata[$value->country_id] = $value->name; } //echo "<pre>";print_r($alldata); exit; $reg_brand_id = ''; // No register brand id for first time. if (Request::isMethod('post')) { $country = DB::table('countries')->where('country_id', '=', Request::input('card_country_id'))->first(); $shipping_card_addr = array('card_holder_fname' => Request::input('card_holder_fname'), 'card_holder_lname' => Request::input('card_holder_lname'), 'company_name' => Request::input('company_name'), 'expiry_month' => Request::input('expiry_month'), 'expiry_year' => Request::input('expiry_year'), 'cvv' => Request::input('cvv'), 'card_shiping_name' => Request::input('card_shiping_name'), 'card_shiping_address' => Request::input('card_shiping_address'), 'card_country_id' => Request::input('card_country_id'), 'card_shiping_city' => Request::input('card_shiping_city'), 'card_shipping_phone_no' => Request::input('card_shipping_phone_no'), 'card_shipping_fax' => Request::input('card_shipping_fax'), 'card_state' => Request::input('card_state'), 'card_shipping_postcode' => Request::input('card_shipping_postcode'), 'email' => Request::input('email'), 'card_number' => Request::input('card_number'), 'country' => $country->name); $res = Authorizenet::createprofile($shipping_card_addr); // echo $res['status']; // echo $res['customer']['payment_profile_id']; //print_r($res);exit; if ($res['status'] == 'fail') { Session::flash('error', 'something went wrong with creditcard details!!' . $res[message] . ' Please try again.'); return redirect('brandregister'); } //echo $_FILES['image']['name']."<pre>";print_r($_FILES);exit; //if(Input::hasFile('government_issue')) if ($_FILES['government_issue']['name'] != "") { $destinationPath = 'uploads/brand_government_issue_id/'; // upload path $extension = Input::file('government_issue')->getClientOriginalExtension(); // getting image extension $government_issue = rand(111111111, 999999999) . '.' . $extension; // renameing image Input::file('government_issue')->move($destinationPath, $government_issue); // uploading file to given path } else { $government_issue = ''; } //if(Input::hasFile('image')) if ($_FILES['image']['name'] != "") { $destinationPath = 'uploads/brandmember/'; // upload path $thumb_path = 'uploads/brandmember/thumb/'; $medium = 'uploads/brandmember/thumb/'; $extension = Input::file('image')->getClientOriginalExtension(); // getting image extension $fileName = rand(111111111, 999999999) . '.' . $extension; // renameing image Input::file('image')->move($destinationPath, $fileName); // uploading file to given path $obj->createThumbnail($fileName, 661, 440, $destinationPath, $thumb_path); $obj->createThumbnail($fileName, 116, 116, $destinationPath, $medium); } else { $fileName = ''; } $slug = $obj->create_slug(Request::input('fname') . " " . Request::input('lname'), 'brandmembers', 'slug'); $hashpassword = Hash::make(Request::input('password')); $address = new Address(); $time = Request::input('calltime'); $date = Request::input('calldate'); $given_date = strtotime($date . " " . $time); $given_date = date("Y-m-d H:s:i", $given_date); $brandmember = Brandmember::create(['fname' => Request::input('fname'), 'lname' => Request::input('lname'), 'email' => Request::input('email'), 'username' => strtolower(Request::input('fname')), 'password' => $hashpassword, 'government_issue' => $government_issue, 'phone_no' => Request::input('phone_no'), 'routing_number' => Request::input('routing_number'), 'account_number' => Request::input('account_number'), 'mailing_name' => Request::input('mailing_name'), 'mailing_address' => Request::input('mailing_address'), 'mailing_country_id' => Request::input('mailing_country_id'), 'mailing_city' => Request::input('mailing_city'), 'mailing_lastname' => Request::input('mailing_lastname'), 'mailing_address2' => Request::input('mailing_address2'), 'mailing_state' => Request::input('mailing_state'), 'mailing_postcode' => Request::input('mailing_postcode'), 'call_datetime' => $given_date, 'paypal_email' => Request::input('paypal_email'), 'mailing_address' => Request::input('mailing_address'), 'default_band_preference' => Request::input('default_band_preference'), 'pro_image' => $fileName, 'role' => 1, 'admin_status' => 0, 'auth_profile_id' => $res['customer']['profile_id'], 'auth_payment_profile_id' => $res['customer']['payment_profile_id'], 'auth_address_id' => $res['customer']['address_id'], 'slug' => $slug]); $shipping_card_addr = array('card_holder_name' => Request::input('card_holder_name'), 'card_number' => Request::input('card_number'), 'card_name' => Request::input('card_name'), 'expiry_month' => Request::input('expiry_month'), 'expiry_year' => Request::input('expiry_year'), 'card_shiping_name' => Request::input('card_shiping_name'), 'card_shiping_address' => Request::input('card_shiping_address'), 'card_country_id' => Request::input('card_country_id'), 'card_shiping_city' => Request::input('card_shiping_city'), 'card_shipping_phone_no' => Request::input('card_shipping_phone_no'), 'card_shipping_address2' => Request::input('card_shipping_address2'), 'card_state' => Request::input('card_state'), 'card_shipping_postcode' => Request::input('card_shipping_postcode')); $shipping_card_addr_serial = serialize($shipping_card_addr); $lastInsertedId = $brandmember->id; $reg_brand_id = $lastInsertedId; //base64_encode ($lastInsertedId); // encrypted last register brand member id $address->mem_brand_id = $lastInsertedId; $address->first_name = Request::input('shiping_fname'); $address->last_name = Request::input('shiping_lname'); $address->address = Request::input('shiping_address'); $address->address2 = Request::input('shipping_address2'); $address->country_id = Request::input('country'); $address->zone_id = Request::input('state'); // State id $address->city = Request::input('city'); $address->postcode = Request::input('shipping_postcode'); $address->serialize_val = ''; if ($address->save()) { $addressId = $address->id; $dataUpdateAddress = DB::table('brandmembers')->where('id', $lastInsertedId)->update(['address' => $addressId]); $sitesettings = DB::table('sitesettings')->get(); //exit; if (!empty($sitesettings)) { foreach ($sitesettings as $each_sitesetting) { if ($each_sitesetting->name == 'email') { $admin_users_email = $each_sitesetting->value; } } } //Session::flash('success', 'Registration completed successfully.Please check your email to activate your account.'); //return redirect('brandregister'); $user_name = Request::input('fname') . ' ' . Request::input('lname'); $user_email = Request::input('email'); $activateLink = url() . '/activateLink/' . base64_encode(Request::input('email')) . '/brand'; $sent = Mail::send('frontend.register.activateLink', array('name' => $user_name, 'email' => $user_email, 'activate_link' => $activateLink), function ($message) use($admin_users_email, $user_email, $user_name) { $message->from($admin_users_email); $message->to($user_email, $user_name)->subject('Activate Profile Mail'); }); if (!$sent) { Session::flash('error', 'something went wrong!! Mail not sent.'); return redirect('brandregister'); } else { Session::flash('success', 'Registration completed successfully.Please check your email to activate your account.'); Session::flash('flush_reg_brand_id', 'open_modal'); Session::put('reg_brand_id', $reg_brand_id); return redirect('brandregister'); } } } return view('frontend.register.registerbrand', compact('alldata'), array('reg_brand_id' => $reg_brand_id)); }
}); Route::post('/lista-email', function () { $validator = Validator::make(Request::all(), ['email' => 'required|email']); if ($validator->fails()) { return back()->withErrors($validator)->withInput(); } $e = App\Listaemail::create(['email' => Request::get('email')]); if ($e === false) { Request::session()->flash('alert-newsletter-danger', 'Ocurrió un error. Por favor intente nuevamente.'); } else { Request::session()->flash('alert-newsletter-success', 'Su dirección de correo electrónico fue agregada. ¡Muchas gracias!'); } return back(); }); Route::match(['get', 'post'], '/contacto', function () { if (Request::isMethod('post')) { $validator = Validator::make(Request::all(), ['nombre' => 'required|string', 'email' => 'required|email', 'provincia' => 'required|string', 'localidad' => 'required|string']); if ($validator->fails()) { return redirect('contacto')->withErrors($validator)->withInput(); } $envio = Mail::send('email-contacto', ['request' => Request::all()], function ($m) { // $m->from(Request::get('email'), Request::get('nombre')); //$m->from('*****@*****.**', 'Nube'); $m->from('*****@*****.**', 'Nube'); $m->replyTo(Request::get('email'), Request::get('nombre')); $m->to('*****@*****.**', 'Valeria')->cc('*****@*****.**', 'Jonathan')->subject('Contacto web nube'); }); if ($envio) { Request::session()->flash('alert-success', 'Su mensaje fue enviado. ¡Muchas gracias!'); } else { Request::session()->flash('alert-danger', 'Ocurrió un error. Por favor intente nuevamente.');
public function peersAction($typeId, $step = 1) { $page = $step - 1; if (Request::isMethod('post')) { } else { //data dari session $nip = Auth::user()->nip; $jabatan = RiwJabStruk::getJabatanOnCompetency($this->competencyData->date_start, $nip); //cek peers $peers = CompetencyPeers::getSoftPeers($this->competencyData->id, $nip); if ($peers != null) { //get jabatan Array $jabatanArray = RiwJabStruk::getJabatanofPeers($this->competencyData->date_start, $peers); //get profile by jabatan Array $profiles = CompetencyProfile::getProfilefromPeers($this->competencyData->id, $jabatanArray, $typeId)->take(1)->skip($page)->first(); //get jabatan from profiles $jabatanProfile = CompetencyProfile::getJabatanfromProfile($this->competencyData->id, $profiles->competency_dictionary_id); //get user detail from jabatan $jabatan = array_intersect($jabatanArray, $jabatanProfile); $users = RiwJabStruk::getUserfromJabatan($this->competencyData->date_start, $jabatan); $this->layout->content = View::make('competency::test.peers', compact('profiles', 'users')); } else { dd('error'); } } }