public function addCart($id)
 {
     $product = Product::find($id);
     $quantity = Input::get('qt');
     $name = $product->name;
     if (intval($quantity) > $product->stock) {
         return Redirect::to('product/' . $id)->with('message', 'La quantité du stock est insufisante pour votre commande');
     }
     if (Session::has('cart')) {
         $carts = Session::get('cart', []);
         foreach ($carts as &$item) {
             if ($item['name'] == $name) {
                 $item["quantity"] += intval($quantity);
                 Session::set('cart', $carts);
                 return Redirect::to('product/' . $id)->with('message', 'Votre panier a été mis à jour');
             }
         }
     }
     $new_item = array();
     $new_item['name'] = $name;
     $new_item['price'] = $product->price;
     $new_item['quantity'] = intval($quantity);
     $new_item['description'] = $product->description;
     $new_item['picture'] = $product->picture;
     Session::push('cart', $new_item);
     return Redirect::to('product/' . $id)->with('message', 'Le produit a été ajouté à votre panier');
 }
예제 #2
0
 public function getAddToCart($product_id)
 {
     $cart = !empty(Session::get('cart.items')) ? Session::get('cart.items') : array();
     if (!in_array($product_id, $cart)) {
         Session::push('cart.items', intval($product_id));
         Session::put("cart.amounts.{$product_id}", intval(1));
     }
     return Redirect::to('cart/my-cart');
 }
 public function viewReset($token)
 {
     Session::forget('email');
     //This causes an offset exception if the token doesn't exist.
     $email = DB::table('password_reminders')->where('token', $token)->first();
     $email = $email->email;
     Session::push('email', '$email');
     return View::make('password.viewReset')->with('token', $token)->with('email', $email);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $cuisines = [];
     if (Input::get('french') == 'french') {
         Session::push('cuisines', 'french');
         $cuisines[] = Input::get('french');
     }
     if (Input::get('italian') == 'italian') {
         Session::push('cuisines', 'italian');
         $cuisines[] = Input::get('italian');
     }
     if (Input::get('chinese') == 'chinese') {
         Session::push('cuisines', 'chinese');
         $cuisines[] = Input::get('chinese');
     }
     if (Input::get('indian') == 'indian') {
         Session::push('cuisines', 'indian');
         $cuisines[] = Input::get('indian');
     }
     if (Input::get('mexican') == 'mexican') {
         Session::push('cuisines', 'mexican');
         $cuisines[] = Input::get('mexican');
     }
     if (Input::get('lebanese') == 'lebanese') {
         Session::push('cuisines', 'lebanese');
         $cuisines[] = Input::get('lebanese');
     }
     if (Input::get('japanese') == 'japanese') {
         Session::push('cuisines', 'japanese');
         $cuisines[] = Input::get('japanese');
     }
     if (Input::get('spanish') == 'spanish') {
         Session::push('cuisines', 'spanish');
         $cuisines[] = Input::get('spanish');
     }
     if (Input::get('greek') == 'greek') {
         Session::push('cuisines', 'greek');
         $cuisines[] = Input::get('greek');
     }
     if (Input::get('american') == 'american') {
         Session::push('cuisines', 'american');
         $cuisines[] = Input::get('american');
     }
     $validation = Validator::make(Input::all(), ['zipcode' => 'max:5']);
     if ($validation->fails()) {
         return Redirect::back()->withInput()->withErrors($validation->messages());
     }
     if (count($cuisines) < 1) {
         return Redirect::back()->withInput();
     }
     Session::push('zipcode', Input::get('zipcode'));
     Session::push('gender', Input::get('gender'));
     return Redirect::route('results.index');
     #Session::get('zipcode');#
 }
예제 #5
0
 public function addToCart($event_id)
 {
     if (Request::ajax()) {
         //on récupère les informations envoyer avec ajax
         $data = Input::all();
         // on récupère les informations du produit
         $product = Produit::find($data['product_id']);
         //on prépare les donnée à insérer dans la session cart
         $parsedata = ['id' => $data['product_id'], 'price' => $data['price'], 'nom' => $product->description, 'evenement_id' => $data['evenement_id']];
         // on charge la session cart avec les nouvelles données.
         Session::push('cart.items', $parsedata);
     }
 }
 public function isValid()
 {
     $validator = Validator::make($this->attributesToArray(), $this->rules);
     if ($validator->fails()) {
         Session::remove('messages');
         foreach ($validator->getMessageBag()->getMessages() as $message) {
             Session::push('messages', $message[0]);
         }
         //			debug(Session::get('messages')); exit;
         return false;
     }
     return true;
 }
예제 #7
0
 public function register()
 {
     Session::clear();
     $data = Input::all();
     $rules = ['username' => 'required|unique:users,username|min:3', 'email' => 'required|email|unique:users,email', 'password' => 'required|confirmed|min:6', 'password_confirmation' => 'required'];
     $validation = Validator::make($data, $rules);
     if ($validation->passes()) {
         $user = $this->userRepo->nuevoUser($data);
         Session::push('iduser', $user->id);
         return \Redirect::route('paso2');
     } else {
         return \Redirect::back()->withInput()->withErrors($validation->messages());
     }
 }
예제 #8
0
 public function setUser($user)
 {
     // Userのセッションを削除
     \Session::forget("User");
     // ログインに成功したのでセッションIDを再生成
     \Session::regenerate();
     $object = app('stdClass');
     $object->id = $user->id;
     $object->username = $user->username;
     $object->email = $user->email;
     // ログインユーザーの情報を保存
     \Session::push('User', $object);
     \Session::save();
 }
 /**
  * Add a notification
  */
 private static function prv_add($_type, $_messages)
 {
     if ($_messages instanceof \Illuminate\Support\MessageBag) {
         $_messages = $_messages->all();
     } elseif ($_messages instanceof \Illuminate\Validation\Validator) {
         $_messages = $_messages->getMessageBag()->all();
     }
     if (is_array($_messages)) {
         foreach ($_messages as $k => $m) {
             \Session::push(self::$mSessionPrefix . '.' . $_type, $m);
         }
     } else {
         \Session::push(self::$mSessionPrefix . '.' . $_type, $_messages);
     }
 }
 public function store()
 {
     $user = User::where('email', '=', Input::get('email'))->first();
     $count = User::where('email', '=', Input::get('email'))->count();
     if ($count == 0) {
         return Redirect::to('/register');
     }
     if ($count > 0 && $user->verified == '0') {
         Session::push('email', Input::get('email'));
         return Redirect::to('/verify');
     }
     if (Auth::attempt(Input::only('email', 'password'))) {
         return Redirect::to('/sessions');
     }
     return Redirect::back()->withInput();
 }
 public function process_form()
 {
     if (!count($_POST)) {
         return View::make('includes/template')->with('template', 'form');
     } else {
         Validator::extend('day_of_month', function ($attribute, $value, $parameters) {
             $month = intval($_POST['dob_month']);
             $year = intval($_POST['dob_year']) ? intval($_POST['dob_year']) : 2013;
             if (!$month) {
                 return false;
             }
             $total_days = date("t", mktime(1, 1, 1, $month, 1, $year));
             return intval($value) <= $total_days;
         });
         $rules = array('picture' => 'Required|Mimes:jpeg|Max:2048', 'image_title' => array('Required', 'Regex:/[\\p{L}\\-_ 0-9]+/u', 'Max:150'), 'drawn_by' => array('Required', 'Regex:/[\\p{L}][\\p{L}\\- ]+/u', 'Max:150'), 'dob_year' => 'Required|Integer|Between:1999,2013', 'dob_month' => 'Required|Integer|Between:1,12', 'dob_day' => 'Required|Integer|Between:1,31|day_of_month', 'title' => array('Required', 'Regex:/^(Mr|Mrs|Ms|Miss|Other)$/'), 'forename' => array('Required', 'Regex:/[\\p{L}][\\p{L}\\- ]+/u', 'Max:150'), 'surname' => array('Required', 'Regex:/[\\p{L}][\\p{L}\\- ]+/u', 'Max:150'), 'address' => array('Required', 'Regex:/[\\p{L}\\-_ 0-9]+/u', 'Max:150'), 'town' => array('Required', 'Max:50', 'Regex:/[\\p{L}\\- ]+/u'), 'country' => 'In:England,Scotland,Wales,Northern Ireland,Republic of Ireland', 'postcode' => array('Regex:/^([a-pr-uwyz]((\\d{1,2})|([a-hk-y]\\d{1,2})|(\\d[a-hjkstuw])|([a-hk-y]\\d[a-z])) *\\d[abd-hjlnp-uw-z]{2})?$/i', 'Max:10'), 'email' => 'Required|Email|Confirmed', 'email_confirmation' => 'Required|Email', 'terms' => 'Required');
         $messages = array('picture.mimes' => "Sorry - our systems don't recognise the type of file you've uploaded. Please have another go with a jpg file", 'picture.max' => "Sorry - the file you've tried to upload is too big for our systems! Please have another go with a smaller jpg", 'image_title.required' => "Oops, your drawing doesn't have a title", 'drawn_by.required' => "Sorry, our systems don't recognise the drawer’s name you've entered. We just want a first name with no numbers or symbols and it must start with a letter. Please try again!", 'drawn_by.regex' => 'Sorry, the name can only contain letters, spaces, and hyphens and it must start with a letter', 'dob_year:required' => 'Sorry, you must enter a year of birth', 'dob_year.integer' => 'Sorry, your year of birth must be between 1999 and the present', 'dob_year.between' => 'Sorry, your year of birth must be between 1999 and the present', 'dob_month:required' => 'Sorry, you must enter the month the drawer was born', 'dob_month.integer' => 'Sorry, the month the drawer was born must be a number from 1 to 12', 'dob_month.between' => 'Sorry, the month the drawer was born must be a number from 1 to 12', 'dob_day.required' => 'Sorry, you need to enter the day of the month the drawer was born', 'dob_day.integer' => 'Sorry, the day of the month the drawer was born should be between 1 and 31', 'dob_day.between' => 'Sorry, the day of the month the drawer was born should be between 1 and 31', 'dob_day.day_of_month' => 'Sorry, that month doesn\'t have that many days!', 'forename.required' => "Hello stranger. We're missing your first name.", 'forename.regex' => 'Sorry, the name can only contain letters, spaces, and hyphens', 'surname.required' => "We're missing your surname.", 'surname.regex' => 'Sorry, the name can only contain letters, spaces, and hyphens', 'address.required' => "We need your address so, if you win, the postman knows where to deliver your petrifying prize.", 'town.required' => "Where do you live?", 'postcode.required' => "Don't forget to pop in your post code.", 'postcode.regex' => "Sorry, our systems don’t recognise what you've entered as a post code. Please use a regular UK format, like KT22 7GR.", 'email.required' => "What's your email?", 'email.email' => "Sorry, our systems don't recognise what you've entered as an email. Please use a regular email format, like info@Persil.com", 'email.confirmed' => "Sorry, the emails you’ve entered don’t match up. Please check them and have another go.", 'terms.required' => "See that tiny box? You need to tick it if you agree to the terms and conditions.");
         $input = Input::all();
         // note to self - all() is required instead of get() if processing uploads - just wasted a good hour hunting down this little bug
         $input['dob_day'] = trim($input['dob_day'], '0');
         $input['dob_month'] = trim($input['dob_month'], '0');
         $validator = Validator::make($input, $rules, $messages);
         if ($validator->fails()) {
             // spit out the form again with the errors shown
             return View::make('includes/template')->with('template', 'form')->with('errors', $validator->messages())->with('input', $input);
         } else {
             // first - process the image
             $image = Persil::save_uploaded_image($input);
             $added = Persil::insert_user_data($input);
             $traction_added = Persil::post_traction_data($input, $this->url, $this->password);
             if ($image && $added) {
                 // push the validated data into the session so that it can be shown in the form again if they go to make another submission
                 Session::put('submitted_data', array());
                 foreach ($input as $key => $value) {
                     if ($key != 'picture') {
                         Session::push("submitted_data.{$key}", $value);
                     }
                 }
                 //Session::put('submitted_data', $input);
                 return View::make('includes/template')->with('template', 'confirmation')->with('input', $input);
             } else {
                 echo 'error page';
             }
             // this will probably be the form again with some generic error message or something
         }
     }
 }
 public function saveProductImage()
 {
     if (!Auth::guest()) {
         $file = Input::file('file');
         $directory = public_path() . '/product_images/';
         $file_name = $file->getClientOriginalName();
         if (!File::exists($directory . $file_name)) {
             $file->move($directory, $file_name);
         }
         if (!Session::has('files')) {
             Session::put('files', []);
         }
         Session::push('files', $file_name);
         return Response::json(array('success' => true));
     }
     return Response::json(array('success' => false));
 }
예제 #13
0
 public function store()
 {
     /*$user =  new User;
       $user->email = Input::get('email');
       $user->*/
     if (!User::isValid(Input::all())) {
         return Redirect::to('/failed');
     }
     $accesscode = Str::random(60);
     User::create(['email' => Input::get('email'), 'password' => Hash::make(Input::get('password')), 'gender' => Input::get('gender'), 'accesscode' => $accesscode, 'verified' => '0']);
     $email_data = array('recipient' => Input::get('email'), 'subject' => 'Share-A-Meal: Verification Code');
     $view_data = ['accesscode' => $accesscode];
     Mail::send('emails.verify', $view_data, function ($message) use($email_data) {
         $message->to($email_data['recipient'])->subject($email_data['subject']);
     });
     Session::push('email', Input::get('email'));
     return Redirect::to('/verify');
 }
예제 #14
0
파일: User.php 프로젝트: ccushing/p4
 public static function setSessionFeeds($user_id)
 {
     # Set Feeds for this user in the Session Variable
     $feeds = \p4\UserFeed::where('user_id', '=', $user_id)->orderby('weight', 'DESC')->get();
     $tags = \p4\Tag::where('user_id', '=', $user_id)->orderby('weight', 'DESC')->get();
     $categories = \p4\Category::where('user_id', '=', $user_id)->orderby('weight', 'DESC')->get();
     foreach ($feeds as $f) {
         $f->stats = $f->get_stats();
     }
     foreach ($tags as $t) {
         $t->stats = $t->get_stats();
     }
     \Session::forget('myfeeds');
     \Session::forget('mytags');
     \Session::forget('categories');
     \Session::push('myfeeds', $feeds);
     \Session::push('mytags', $tags);
     \Session::push('categories', $categories);
 }
예제 #15
0
 public static function menu()
 {
     $items = [];
     $menu = __DIR__ . '/../Data/admin_menu.json';
     $routes = array();
     if (file_exists($menu)) {
         $options = json_decode(file_get_contents($menu), true);
         foreach ($options as $n => $o) {
             $add = true;
             if (array_key_exists('type', $o)) {
                 $add = \Auth::user()->type == $o['type'];
             }
             if ($add) {
                 $item = ['label' => $n, 'icon' => $o['icon'], 'route' => $o['route'], 'container' => isset($o['container']) ? $o['container'] : '', 'class' => isset($o['class']) ? $o['class'] : ''];
                 array_push($routes, $o['code']);
                 array_push($items, $item);
             }
         }
     }
     // Add routes to session
     \Session::push('routes', $routes);
     return $items;
 }
예제 #16
0
 /**
  * [getAjaxAddtocart description]
  * @return [type] [description]
  */
 public function getAjaxAddtocart()
 {
     if (Session::has('array_slug')) {
         if (in_array($_GET['slug'], Session::get('array_slug'))) {
             $data = array('title' => 'Thông Báo', 'body' => 'Hàng hóa đã tồn tại!');
         } else {
             Session::push('array_slug', $_GET['slug']);
             $count = $_GET['count'] + 1;
             $old_price = str_replace(".", "", $_GET['old_price']);
             $new_price = (int) $old_price + (int) $_GET['price'];
             Session::put('price_cart', adddotstring($new_price));
             Session::put('count_product', $count);
             $data = array('title' => 'Thông Báo', 'body' => 'Thêm sản phẩm thành công !', 'count' => $count, 'price' => adddotstring($new_price));
         }
     } else {
         Session::push('array_slug', $_GET['slug']);
         $count = $_GET['count'] + 1;
         $new_price = (int) $_GET['old_price'] + (int) $_GET['price'];
         Session::put('price_cart', adddotstring($new_price));
         Session::put('count_product', $count);
         $data = array('title' => 'Thông Báo', 'body' => 'Thêm sản phẩm thành công !', 'count' => $count, 'price' => adddotstring($new_price));
     }
     return json_encode($data);
 }
예제 #17
0
 /**
  * Return the relist item view.
  *
  * @param int $itemId
  *
  * @return \Illuminate\View\View
  */
 public function getRelist($itemId)
 {
     $item = Item::findOrFail($itemId);
     Session::forget('photos');
     foreach ($item->photos as $photo) {
         Session::push('photos', ['real_path' => $photo->getPath(), 'filename' => $photo->photoId]);
     }
     $categories = Category::leaves()->orderBy('category_id')->get();
     return view('mustard::item.new', ['item' => $item, 'categories' => $categories]);
 }
예제 #18
0
/**
 * Push a value onto a session array.
 *
 * @param  string  $key
 * @param  mixed   $value
 * @return void
 */
function zbase_session_push($key, $value)
{
    \Session::push(zbase_session_name($key), $value);
}
예제 #19
0
 public function filter($filter = null, $value = null)
 {
     if ($filter != null) {
         $value = str_replace('-', ' ', $value);
         if ($filter === 'brand') {
             Session::forget('filter.brand');
             Session::push('filter.brand', $value);
         } else {
             if ($filter === 'transmission') {
                 Session::forget('filter.transmission');
                 Session::push('filter.transmission', $value);
             }
         }
     } else {
         if (Input::get('brand')) {
             Session::forget('filter.brand');
             Session::push('filter.brand', Input::get('brand'));
         }
         if (Input::get('transmission')) {
             Session::forget('filter.transmission');
             Session::push('filter.transmission', Input::get('transmission'));
         }
     }
     if (Session::has('filter')) {
         if (Session::has('filter.brand') && Session::has('filter.transmission')) {
             $entries = Catalog::whereHas('car', function ($query) {
                 $query->where('transmission', 'like', Session::get('filter.transmission'))->where('brand', 'like', Session::get('filter.brand'));
             })->orderBy('created_at', 'desc')->get();
         } else {
             if (Session::has('filter.brand')) {
                 $entries = Catalog::whereHas('car', function ($query) {
                     $query->where('brand', 'like', Session::get('filter.brand'));
                 })->orderBy('created_at', 'desc')->get();
             } else {
                 $entries = Catalog::whereHas('car', function ($query) {
                     $query->where('transmission', 'like', Session::get('filter.transmission'));
                 })->orderBy('created_at', 'desc')->get();
             }
         }
     } else {
         $entries = Catalog::with('car')->orderBy('created_at', 'desc')->get();
     }
     $page = Page::where('type', '=', 3)->firstOrFail();
     if (Session::has('filter.transmission')) {
         $brandsForFilter = DB::table('cars')->distinct('brand')->where('transmission', Session::get('filter.transmission.0'))->lists('brand');
     } else {
         $brandsForFilter = DB::table('cars')->distinct('brand')->lists('brand');
     }
     return View::make('front.pages.inventory-filtered')->with(['entries' => $entries, 'page' => $page, 'filters' => Session::get('filter'), 'brandsForFilter' => $brandsForFilter]);
 }
 private static function validateConference($confTitle, $venueName)
 {
     if (empty($confTitle) || empty($venueName)) {
         Session::push('feedback_negative', Text::get('CONFERENCE_FIELD_EMPTY'));
         return false;
     }
     // no conference by this title should exist
     if (ConferenceModel::getConferenceByTitle($confTitle)) {
         Session::push('feedback_negative', Text::get('CONFERENCE_ALREADY_EXISTS'));
         return false;
     }
     if (!VenueModel::venueExists($venueName)) {
         if (!VenueModel::createVenueInDb($venueName)) {
             Session::push('feedback_negative', Text::get('UNKNOWN_ERROR'));
             return false;
         }
     }
     return true;
 }
예제 #21
0
 public function changeLocale($locale)
 {
     Session::push('locale', $locale);
     return redirect('trangchu');
 }
예제 #22
0
파일: routes.php 프로젝트: ndmson/FINCH
             return View::make('pages.MyCart.' . $qlmPage)->with(array('_detailURL' => $qlmPage));
             break;
         case 'checkout3':
             if (Session::has('checkout.address')) {
                 Session::forget('checkout.address');
             }
             $_data = array('firstName' => Input::get('firstName', '-'), 'lastName' => Input::get('lastName', '-'), 'email' => Input::get('email', '-'), 'companyname' => Input::get('companyname', '-'), 'country' => Input::get('country', '-'), 'state' => Input::get('state', '-'), 'street' => Input::get('street', '-'), 'zipcode' => Input::get('zipcode', '-'), 'telephone' => Input::get('telephone', '-'), 'comment' => Input::get('comment', '-'));
             Session::push('checkout.address', $_data);
             return View::make('pages.MyCart.' . $qlmPage)->with(array('_detailURL' => $qlmPage));
             break;
         case 'checkout4':
             if (Session::has('checkout.payment')) {
                 Session::forget('checkout.payment');
             }
             $_data = array('payment' => Input::get('payment', '-'));
             Session::push('checkout.payment', $_data);
             return View::make('pages.MyCart.' . $qlmPage)->with(array('_detailURL' => $qlmPage));
             break;
     }
 }
 $_resultPageDetail = DB::table('finch_pagedetails')->where('detailVisible', '=', '1')->where('isMenu', '=', '1')->where('detailURL', '=', $qlmPage)->get();
 $_page = $_resultPageDetail[0]->detailType;
 $_template = $_resultPageDetail[0]->detailTemplate;
 switch ($_page) {
     case '1':
         switch ($_template) {
             case 'TFINCH002':
                 return View::make('pages.Dynamic.Layout2')->with(array('_detailURL' => $qlmPage));
                 break;
             case 'TFINCH010':
                 return View::make('pages.Dynamic.Layout3')->with(array('_detailURL' => $qlmPage));
예제 #23
0
 private function syncSessionToCart()
 {
     \Session::push('myHamper', $this->items);
 }
예제 #24
0
파일: index.php 프로젝트: kvox/TVSS
    }
}
if ((isset($menu) && $menu == 'login' || isset($action) && $action == 'login') && isset($username) && isset($password)) {
    $errors = $app['user']->login($username, $password);
    if (isset($returnpath) && $returnpath || isset($menu) && $menu == 'login') {
        print "<script>window.location='{$baseurl}{$returnpath}';</script>";
        exit;
    }
}
if (isset($action) && $action == 'change_avatar' && Session::has('loggeduser_id')) {
    if (isset($_FILES['avatar_file']['name']) && $_FILES['avatar_file']['name']) {
        if ($_FILES["avatar_file"]["type"] == "image/gif" || $_FILES["avatar_file"]["type"] == "image/jpeg" || $_FILES["avatar_file"]["type"] == "image/pjpeg" || $_FILES["avatar_file"]["type"] == "image/png") {
            $filename = Session::get('loggeduser_id') . "_" . date("YmdHis") . ".jpg";
            if (move_uploaded_file($_FILES["avatar_file"]["tmp_name"], "{$basepath}/thumbs/users/" . $filename)) {
                $app['user']->update(Session::get('loggeduser_id'), array("avatar" => $filename));
                Session::push('loggeduser_details.avatar', $filename);
                $data = array();
                $data['user_id'] = Session::get('loggeduser_id');
                $data['user_data'] = Session::get('loggeduser_id');
                $data['target_id'] = 0;
                $data['target_data'] = array();
                $data['target_type'] = 0;
                $data['event_date'] = date("Y-m-d H:i:s");
                $data['event_type'] = 4;
                $data['event_comment'] = '';
                $app['stream']->addActivity($data);
                unset($app['stream']);
            }
        }
    }
}
예제 #25
0
 public function postConstruccion()
 {
     if (!Session::has('cotizacion.productos')) {
         Session::put('cotizacion.productos', array());
     }
     $servicio = VistaServicioFuneral::find(Input::get('producto_servicio_id'))->get;
     $producto["id"] = $servicio->id;
     $producto["cantidad"] = Input::get('cantidad');
     $producto["descripcion"] = $servicio->nombre;
     $producto["precio"] = $servicio->precio_servicio * 1.16;
     $producto["porcentaje_comision"] = $servicio->porcentaje_comision;
     Session::push('cotizacion.productos', $producto);
     return Redirect::action('CotizacionControlador@getCreate');
 }
예제 #26
0
파일: session.php 프로젝트: hellopsm/robot
 function set_chara($chara_name)
 {
     Session::push('his_chara', $chara_name);
 }
예제 #27
0
파일: routes.php 프로젝트: r8filipe/LAPR
Route::post('/book/edit', ['middleware' => 'auth.role:1', 'uses' => 'BookController@edit']);
Route::post('/book/create', 'BookController@create');
// Authentication routes...
Route::get('auth/login', 'Auth\\AuthController@getLogin');
Route::post('auth/login', 'Auth\\AuthController@postLogin');
Route::get('auth/logout', 'Auth\\AuthController@getLogout');
// Registration routes...
Route::get('auth/register', 'Auth\\AuthController@getRegister');
Route::post('auth/register', 'Auth\\AuthController@postRegister');
//paypal
Route::post('payment', array('as' => 'payment', 'uses' => 'PaypalController@postPayment'));
// Después de realizar el pago Paypal redirecciona a esta ruta
Route::get('payment/status', array('as' => 'payment.status', 'uses' => 'PaypalController@getPaymentStatus'));
//carrinho
Route::get('/cart/add/{product}', ['middleware' => 'auth.role:1', function ($product) {
    Session::push('cart.items', $product);
    return back();
}]);
Route::get('/cart/clear', ['middleware' => 'auth.role:1', function () {
    Session::forget('cart');
    return back();
}]);
Route::get('/cart/show', ['middleware' => 'auth.role:1', function () {
    if (Session::has('cart.items')) {
        $books = \App\Book::find(Session::get('cart.items'));
        return view('cart/show', ['books' => $books]);
    }
}]);
Route::get('/cart/remove/{id}', ['middleware' => 'auth.role:1', function ($id) {
    foreach (Session::get('cart.items') as $key => $item) {
        if ($item == $id) {
예제 #28
0
파일: routes.php 프로젝트: kenkode/umash-1
    Session::push('purchaseitems', ['itemid' => $item_id, 'item' => $item_name, 'price' => $price, 'quantity' => $quantity, 'duration' => $duration]);
    $orderitems = Session::get('purchaseitems');
    $items = Item::all();
    $locations = Location::all();
    $taxes = Tax::all();
    return View::make('erppurchases.purchaseitems', compact('items', 'locations', 'taxes', 'orderitems'));
});
Route::post('quotationitems/create', function () {
    $data = Input::all();
    $item = Item::findOrFail(array_get($data, 'item'));
    $item_name = $item->name;
    $price = $item->selling_price;
    $quantity = Input::get('quantity');
    $duration = Input::get('duration');
    $item_id = $item->id;
    Session::push('quotationitems', ['itemid' => $item_id, 'item' => $item_name, 'price' => $price, 'quantity' => $quantity, 'duration' => $duration]);
    $orderitems = Session::get('quotationitems');
    $items = Item::all();
    $locations = Location::all();
    $taxes = Tax::all();
    return View::make('erpquotations.quotationitems', compact('items', 'locations', 'taxes', 'orderitems'));
});
Route::get('orderitems/remove/{id}', function ($id) {
    Session::forget('orderitems', $id);
    $orderitems = Session::get('orderitems');
    $items = Item::all();
    $locations = Location::all();
    $taxes = Tax::all();
    return View::make('erporders.orderitems', compact('items', 'locations', 'taxes', 'orderitems'));
});
Route::get('purchaseitems/remove/{id}', function ($id) {
 /**
  * Validate the user against the DB, or increment the "failed-login-count" to prevent
  * bruteforce password/user attacks
  * @param string $userName
  * @param string $userPassword
  * @return mixed
  */
 private static function validateUser(string $userName, string $userPassword)
 {
     if (Session::get('failed-login-count') >= 3 && Session::get('last-failed-login') > time() - 30) {
         Session::push('feedback_negative', Text::get("LOGIN_FAILED_ATTEMPTS"));
         return false;
     }
     $result = UserModel::getUserByName($userName);
     if (!$result) {
         self::incrementUserFailedLoginCount();
         Session::push("feedback-negative", Text::get("USERNAME_OR_PASSWORD_WRONG"));
         return false;
     }
     if ($result->user_failed_logins >= 3 && $result->user_last_failed_login > time() - 30) {
         Session::push('feedback_negative', Text::get('PASSWORD_WRONG_ATTEMPTS'));
         return false;
     }
     if (!password_verify($userPassword, $result->user_password_hash)) {
         self::incrementUserFailedLoginCountInDb($result->user_name);
         Session::push('feedback_negative', Text::get('USERNAME_OR_PASSWORD_WRONG'));
         return false;
     }
     self::resetUserFailedLoginCount();
     return $result;
 }
예제 #30
0
      *  Shopping Cart
      *
      */
 /*
  *  Shopping Cart
  *
  */
 case 'qlmbasket':
     return View::make('pages.MyCart.' . $qlmPage)->with(array('_strTitle' => $qlmPage, '_strBannerTitle' => '<font color="#e4002b">qlmbasket</font>', '_strBannerDesc' => 'qlmbasket', '_strBannerImage' => 'asserts/images/SecondPage/mainpage_label.jpg', '_strFaceTitle' => 'shopping cart'));
     break;
 case 'checkout1':
     return View::make('pages.MyCart.' . $qlmPage)->with(array('_strTitle' => 'Address Checkout', '_strBannerTitle' => 'checkout1', '_strBannerDesc' => 'checkout1', '_strBannerImage' => 'asserts/images/SecondPage/mainpage_label.jpg', '_strFaceTitle' => 'checkout step 1'));
     break;
 case 'checkout2':
     $_data = array('firstName' => Input::get('firstName', '-'), 'lastName' => Input::get('lastName', '-'), 'email' => Input::get('email', '-'), 'companyname' => Input::get('companyname', '-'), 'country' => Input::get('country', '-'), 'state' => Input::get('state', '-'), 'street' => Input::get('street', '-'), 'zipcode' => Input::get('zipcode', '-'), 'telephone' => Input::get('telephone', '-'), 'comment' => Input::get('comment', '-'));
     Session::push('checkout.address', $_data);
     return View::make('pages.MyCart.' . $qlmPage)->with(array('_strTitle' => 'Delivery Checkout', '_strBannerTitle' => 'checkout2', '_strBannerDesc' => 'checkout2', '_strBannerImage' => 'asserts/images/SecondPage/mainpage_label.jpg', '_strFaceTitle' => 'checkout step 2'));
     break;
 case 'checkout3':
     return View::make('pages.MyCart.' . $qlmPage)->with(array('_strTitle' => 'Payment Checkout', '_strBannerTitle' => 'checkout3', '_strBannerDesc' => 'checkout3', '_strBannerImage' => 'asserts/images/SecondPage/mainpage_label.jpg', '_strFaceTitle' => 'checkout step 2'));
     break;
 case 'checkout4':
     return View::make('pages.MyCart.' . $qlmPage)->with(array('_strTitle' => 'Review Checkout', '_strBannerTitle' => 'checkout4', '_strBannerDesc' => 'checkout4', '_strBannerImage' => 'asserts/images/SecondPage/mainpage_label.jpg', '_strFaceTitle' => 'checkout step 4'));
     break;
     /*
      * End of Shopping Cart
      *
      */
 /*
  * End of Shopping Cart
  *