Пример #1
0
 public function logout(Request $request)
 {
     $posts = \App\Post::orderBy('updated_at', 'desc')->paginate($this->peginate_pages_count);
     $users = \App\User::all();
     \Session::forget('user_id');
     return Redirect::action('ExampleController@index');
 }
 public function getPaymentStatus()
 {
     // Get the payment ID before session clear
     $payment_id = \Session::get('paypal_payment_id');
     // clear the session payment ID
     \Session::forget('paypal_payment_id');
     if (empty(\Input::get('PayerID')) || empty(\Input::get('token'))) {
         return \Redirect::route('original.route')->with('error', 'Payment failed');
     }
     $payment = Payment::get($payment_id, $this->_api_context);
     // PaymentExecution object includes information necessary
     // to execute a PayPal account payment.
     // The payer_id is added to the request query parameters
     // when the user is redirected from paypal back to your site
     $execution = new PaymentExecution();
     $execution->setPayerId(\Input::get('PayerID'));
     //Execute the payment
     $result = $payment->execute($execution, $this->_api_context);
     echo '<pre>';
     print_r($result);
     echo '</pre>';
     exit;
     // DEBUG RESULT, remove it later
     if ($result->getState() == 'approved') {
         // payment made
         return \Redirect::route('original.route')->with('success', 'Payment success');
     }
     return \Redirect::route('original.route')->with('error', 'Payment failed');
 }
Пример #3
0
 private function autoLogin()
 {
     try {
         if (\Session::has('userID')) {
         } else {
             //try set session from cookies if no session
             if (!empty(\Cookie::get('userID'))) {
                 $field = array('field' => '_id', 'value' => (string) \Cookie::get('userID'));
                 if (Auth::isExists($field)) {
                     \Session::put('userID', \Cookie::get('userID'));
                     //
                     //return \Response::make()->withCookie(\Cookie::make('userID', \Cookie::get('userID') , self::COOKIE_EXPIRE));
                 } else {
                     throw new AuthCheckException('username', 'auth.username.doesnt.exist');
                 }
             } else {
                 //\Session::forget('userID')->withCookie(\Cookie::forget('userID'))->withCookie(\Cookie::forget('userID'));
                 throw new AuthCheckException('userid', 'auth.userid.doesnt.exist');
             }
         }
     } catch (Exception $e) {
         $return = \Response::json(["message" => "Session logout!"], 400);
         \Session::forget('userID');
         return $return->withCookie(Cookie::forget('userID'))->withCookie(Cookie::forget('userID'));
     }
 }
Пример #4
0
 public function getLogout()
 {
     if (\Session::has('UserID')) {
         \Session::forget('UserID');
     }
     $this->auth->logout();
     return redirect(url('/user/login'));
 }
Пример #5
0
 public function delete($id)
 {
     if (\Session::has('product8')) {
         \Session::forget('product8.' . $id);
         $kol = \Session::get('addToBasket');
         \Session::forget('addToBasket', $kol - 1);
     }
     return redirect('basket');
 }
 public function toRemove()
 {
     if (session('organization') == null) {
         return redirect('/home/organizations/home');
     } else {
         \Session::forget('organization');
         return redirect('/home/organizations');
     }
 }
 public function getPaymentStatus()
 {
     // Get the payment ID before session clear
     $payment_id = \Session::get('paypal_payment_id');
     $order_id = \Session::get('order_id');
     \Session::forget('paypal_payment_id');
     \Session::forget('order_id');
     if (empty(\Input::get('PayerID')) || empty(\Input::get('token'))) {
         // payment failure actions
         \Session::put('cart_preview', $this->BuyModel->cartPreview(['buyer_id' => $this->user]));
         $this->BuyModel->removeFromPreorder(['buyer_id' => $this->user]);
         $this->BuyModel->deleteOrderId($order_id);
         // end payment failure actions
         return redirect('checkout')->with('alert', 'Payment cancelled');
     }
     $payment = Payment::get($payment_id, $this->_api_context);
     // PaymentExecution object includes information necessary
     // to execute a PayPal account payment.
     // The payer_id is added to the request query parameters
     // when the user is redirected from paypal back to your site
     $execution = new PaymentExecution();
     $execution->setPayerId(\Input::get('PayerID'));
     //Execute the payment
     $result = $payment->execute($execution, $this->_api_context);
     $paypal = ['order_id' => $order_id];
     $args = ['buyer_id' => $this->user];
     if ($result->getState() == 'approved') {
         // payment made
         $paypal['payment_id'] = $result->getId();
         $paypal['status'] = $result->getState();
         $paypal['create_time'] = $result->getCreateTime();
         $paypal['email'] = $result->getPayer()->getPayerInfo()->getEmail();
         $payerAddress = $result->getPayer()->getPayerInfo()->getShippingAddress();
         $paypal['line1'] = $payerAddress->getLine1();
         $paypal['city'] = $payerAddress->getCity();
         $paypal['state'] = $payerAddress->getState();
         $paypal['postal_code'] = $payerAddress->getPostalCode();
         $paypal['country_code'] = $payerAddress->getCountryCode();
         unset($payerAddress);
         $transaction = $result->getTransactions()[0]->getAmount();
         $paypal['total'] = $transaction->getTotal() * 100;
         $paypal['currency'] = $transaction->getCurrency();
         unset($transaction);
         $this->BuyModel->insertPayment($paypal);
         $args['checkout'] = 1;
         $info = ['order_id' => $order_id];
         $this->BuyModel->insertOrderItems($info, $args);
         $this->BuyModel->deleteFromCart($args);
         //    email sellers to ship
         // $headers = "From: orders@colorcreep.com";
         $text = "Your Order " . $order_id . " has processed.";
         mail($paypal['email'], "Your Color Creep Order", $text);
         return redirect('order?id=' . $order_id)->with('alert', 'Payment complete');
     } else {
         $this->BuyModel->removeFromPreorder($args);
         $this->BuyModel->deleteOrderId($order_id);
         return redirect('cart')->with('alert', 'There was an error processing your payment');
     }
     return redirect('cart');
 }
 public function exitSupport()
 {
     Auth::logout();
     \Session::forget('support');
     $id = \Session::get('id_support');
     $user = User::findOrFail($id);
     $userPassword = UserPassword::whereRaw('user_id = ?', array($id))->first();
     $decrypted = \Crypt::decrypt($userPassword->crypt_password);
     if (Auth::attempt(['email' => $user->email, 'password' => $decrypted])) {
         return new RedirectResponse(url('/home'));
     } else {
         return new RedirectResponse(url('/home'));
     }
 }
 function back_button()
 {
     if (\Session::has('entry_date')) {
         \Session::forget('entry_date');
     }
     $active = $this->check();
     if ($active) {
         $Session = \Session::all();
         //return view('Dashboard', compact('Session'));
         return \Redirect::to('dashboard');
     } else {
         return \Redirect::to('login');
     }
 }
Пример #10
0
 public function logOut(Request $request)
 {
     \Session::forget('username');
     ParseUser::logOut();
     return redirect('/');
 }
Пример #11
0
 public function postLogout()
 {
     \Session::forget('fb_user_id');
     return \Response::json(['success' => true]);
 }
Пример #12
0
 public function trash()
 {
     \Session::forget('cart');
     return redirect()->route('cart-show');
 }
Пример #13
0
 /**
  * @author NgocNguyen
  * @name getComplete
  * @todo view complete page
  * @return Response
  * @access public
  */
 public function getComplete($catalogItem)
 {
     $form = \Helper::getFormTable($catalogItem);
     if ($form == 'input-r2') {
         return view('pages.default.catalog.r2.complete-r2', ['form' => $form, 'flag' => 'complete']);
     }
     // get flag for view
     $flag = $this->selectDefault($catalogItem);
     \Session::forget('dct');
     return view('pages.default.catalog.complete', ['catalogItem' => $catalogItem, 'panel' => $this->checkVisualArea($catalogItem), 'flag' => $flag]);
 }
Пример #14
0
 /**
  * show and handle compete page
  *
  * @author My Vo
  *
  * @return \Illuminate\View\View
  */
 public function postComplete(Prj02FormR5 $prj02FormR5, CatalogFormR5 $catalogFormR5)
 {
     // Get platform
     $platFormID = \Session::get('id');
     // Return to cache
     \Helper::catalogLoad($platFormID, $prj02FormR5->platformName);
     $catalogList = $prj02FormR5->platformName . $platFormID . 'List';
     // get item from cache
     $listItem = \Cache::get($catalogList);
     $arrItem = \Session::get('dct');
     foreach ($arrItem as $key => $value) {
         if (empty($value)) {
             break;
         }
         $arrItem[$key] = array_shift($listItem[$value]);
     }
     // ext1 field data
     $item = implode(',', $arrItem);
     //serial number
     $serial_number = date('yymm-55');
     //Registration date
     //※2015年 7月 6日(月曜日) 17時 29分
     $youbi = ['日', '月', '火', '水', '木', '金', '土'];
     $registration_date = date('Y年 n月 j日(') . $youbi[date('w')] . date(') G:i');
     // Select model and system name by catalogItem
     $systemData = \Helper::getItemInfo("constants.system_catalog.{$this->catalogItem}");
     $prj02FormR5->fill($catalogFormR5->all());
     $prj02FormR5['name1'] = $prj02FormR5['name1'] . " " . $prj02FormR5['name2'];
     $prj02FormR5['kana1'] = $prj02FormR5['kana1'] . " " . $prj02FormR5['kana2'];
     $prj02FormR5['address1'] = $prj02FormR5['area'] . $prj02FormR5['address1'];
     $prj02FormR5['ext8'] = $prj02FormR5['ext8'] . $prj02FormR5['ext9'];
     $prj02FormR5['ext1'] = $item;
     $prj02FormR5['form'] = $systemData['form'];
     $prj02FormR5['uid'] = $systemData['uid'];
     $prj02FormR5['ext6'] = $serial_number;
     $prj02FormR5['ext7'] = $registration_date;
     $prj02FormR5['ext11'] = '希望しない';
     $prj02FormR5['ext12'] = '希望しない';
     // unset attributes
     unset($prj02FormR5['name2']);
     unset($prj02FormR5['kana2']);
     unset($prj02FormR5['area']);
     unset($prj02FormR5['ext9']);
     // array item send email
     $arrItem = $prj02FormR5->getAttributes();
     // save
     $prj02FormR5->save();
     // Get subject, URL
     $arrItem['URL'] = \Helper::getItemInfo("constants.system_catalog.{$this->catalogItem}")['URL'];
     $arrItem['subject'] = \Helper::getItemInfo("constants.system_catalog.{$this->catalogItem}")['MailSubjectAdmin'];
     $arrItem['CATALOG_ITEM'] = 'catalog_' . $this->catalogItem;
     // Send mail admin
     \Helper::sendMailAdmin($arrItem, $arrItem['subject']);
     // Send mail user
     $subject = \Helper::getItemInfo("constants.system_catalog.{$this->catalogItem}")['MailSubjectClient'];
     \Helper::sendMailUser($arrItem, $arrItem['email1'], $subject);
     \Session::regenerateToken();
     \Session::forget('dct');
     \Session::forget('id');
     \Session::forget('info_input');
     \Session::forget('cat_item');
     return view('pages.default.catalog.r5.complete');
 }
Пример #15
0
 /**
  * Display a listing of the resource.
  * Muestra la vista principal para Gestionar un Plan de Desarrollo
  * @return Response
  */
 public function nuevoPlanMunicipal()
 {
     \Session::forget('id_plan');
     return view('template.PlanDesarrollo.registrar_plan.new_plan');
 }
Пример #16
0
 public function logout()
 {
     \Session::forget('tempuser.token');
     return \Redirect::route('login');
 }
 public function getHerhalingLogin($slug, Webinar $w, Webinarherhaling $wh, Attendee $a)
 {
     $webinar = $w->where('slug', $slug)->first();
     $hetwebinar = $webinar->webinarherhaling->first();
     $webinardatum = $hetwebinar->herhaling_start_tijd;
     $webinareind = $hetwebinar->herhaling_eind_tijd;
     \Session::forget('deattendee');
     if (Carbon::now() < $webinardatum) {
         return view('webinars.tevroeg', compact('hetwebinar'));
     } elseif (Carbon::now() > $webinareind) {
         return view('webinars.telaat', compact('hetwebinar'));
     } else {
         return view('webinars.herhalinglogin', compact('hetwebinar'));
     }
 }
 public function getAgencyPaymentCancel(Request $request)
 {
     \Session::forget('_temp_payment_sess');
     return redirect($data['redirect'])->with('flashMessage', ['class' => 'info', 'message' => 'You have cancelled your last payment']);
 }
 public function checkout()
 {
     //Check if user is logged in
     if (!Backend::validateUser()) {
         return redirect('/');
     }
     $aRequest = \Request::all();
     //This is a temprory array that will be used to create a temp item to be used in saved and any processing on item before saving it.
     $tempItem = array();
     if (!isset($aRequest['items'])) {
         return;
     }
     /*
      * Total price will be saved here,
      * this also will be used to indicate the last price that will be required on each restaurant
      */
     foreach ($aRequest['items'] as $item) {
         $dTotalPrice = 0;
         $oItem = DB::table('food')->where(array('id_item' => $item['id_item']))->get(array("id_restaurant", "price"))[0];
         $tempItem['id_item'] = $item['id_item'];
         $tempItem['qty'] = $item['qty'];
         $tempItem['spicy'] = $item['spicy'];
         //$tempItem['note']=$item['note'];
         $tempItem['total_price'] = $oItem->price * $item['qty'];
         $dTotalPrice += $tempItem['total_price'];
         $aRestaurants[$oItem->id_restaurant]['total_price'] = $dTotalPrice;
         $aRestaurants[$oItem->id_restaurant]['items'][] = $tempItem;
         $tempItem = array();
     }
     $sNote = $aRequest['note'];
     $sLocation = json_encode($aRequest['location']);
     foreach ($aRestaurants as $id_restaurant => $aRestaurant) {
         $id_user = \Session::all()['id_user'];
         $sOrderDetails = json_encode($aRestaurant);
         $aOrder = array('id_user' => $id_user, 'id_restaurant' => $id_restaurant, 'order_details' => $sOrderDetails, 'note' => $sNote, 'location' => $sLocation, 'date_inserted' => Date('Y-m-d h:i:s'), 'status' => 'not_approved_yet');
         DB::table('orders')->insert($aOrder);
     }
     \Session::forget('cart');
     return redirect('/');
 }
Пример #20
0
 public function logout()
 {
     \Session::forget('userID');
     $return = \Response::json(["message" => "Session logout!"], 200);
     return $return->withCookie(\Cookie::forget('userID'));
 }
 public function getPaymentStatus()
 {
     // Get the payment ID before session clear
     $payment_id = \Session::get('paypal_payment_id');
     $user_id = \Session::get('user_id');
     $amount = \Session::get('amount');
     // clear the session payment ID
     \Session::forget('paypal_payment_id');
     if (empty(\Input::get('PayerID')) || empty(\Input::get('token'))) {
         return \Redirect::route('original.route')->with('error', 'Payment failed');
     }
     $payment = Payment::get($payment_id, $this->_api_context);
     // PaymentExecution object includes information necessary
     // to execute a PayPal account payment.
     // The payer_id is added to the request query parameters
     // when the user is redirected from paypal back to your site
     $execution = new PaymentExecution();
     $execution->setPayerId(\Input::get('PayerID'));
     //Execute the payment
     $result = $payment->execute($execution, $this->_api_context);
     //echo '<pre>';print_r($result);echo '</pre>'; //exit; // DEBUG RESULT, remove it later
     if ($result->getState() == 'approved') {
         // payment made
         $user = \DB::table('users')->where('id', '=', $user_id)->first();
         $user2 = User::where('id', '=', $user_id);
         $new_project_data = array("balance" => $user->balance + $amount);
         // project  ανοιχτο
         $user2->update($new_project_data);
         return view('payment_status')->with(array('status' => 0, 'balance' => $user->balance + $amount, 'amount' => $amount));
     } else {
         return view('payment_status')->with(array('status' => 1, 'user_id' => $user_id));
     }
 }
 public function home()
 {
     \Session::forget('currentSerie');
     return view('pages.home');
 }
 /**
  * Remove the specified resource from storage.
  * delete item in cart 
  * @param  int  $id
  * @return Response
  */
 public function postDestroy($id)
 {
     $data = \Session::get('giohang');
     unset($data[$id]);
     if (is_null($data)) {
         \Session::forget('giohang');
     } else {
         \Session::put('giohang', $data);
     }
     return redirect('/cart/index');
 }
Пример #24
0
 public function getPaymentStatus()
 {
     // Get the payment ID before session clear
     $payment_id = \Session::get('paypal_payment_id');
     // clear the session payment ID
     \Session::forget('paypal_payment_id');
     $payerId = \Input::get('PayerID');
     $token = \Input::get('token');
     //if (empty(\Input::get('PayerID')) || empty(\Input::get('token'))) {
     if (empty($payerId) || empty($token)) {
         return \Redirect::route('home')->with('message', 'Hubo un problema al intentar pagar con Paypal');
     }
     $payment = Payment::get($payment_id, $this->_api_context);
     // PaymentExecution object includes information necessary
     // to execute a PayPal account payment.
     // The payer_id is added to the request query parameters
     // when the user is redirected from paypal back to your site
     $execution = new PaymentExecution();
     $execution->setPayerId(\Input::get('PayerID'));
     //Execute the payment
     $result = $payment->execute($execution, $this->_api_context);
     //echo '<pre>';print_r($result);echo '</pre>';exit; // DEBUG RESULT, remove it later
     if ($result->getState() == 'approved') {
         // payment made
         // Registrar el pedido --- ok
         // Registrar el Detalle del pedido  --- ok
         // Eliminar carrito
         // Enviar correo a user
         // Enviar correo a admin
         // Redireccionar
         $this->saveOrder(\Session::get('cart'));
         \Session::forget('cart');
         return \Redirect::route('home')->with('message', 'Compra realizada de forma correcta');
     }
     return \Redirect::route('home')->with('message', 'La compra fue cancelada');
 }
Пример #25
0
 public static function restricted()
 {
     if (\Session::get('accessDenied')) {
         \Session::forget('accessDenied');
         $modelConfig = new ModelConfig();
         return \View::make('gtcms.admin.elements.restricted')->with(array('active' => false, 'modelConfig' => $modelConfig));
     } else {
         return \Redirect::to("/admin");
     }
 }
 public function logoutAuth()
 {
     Auth::logout();
     Session::forget('user');
     return response()->json(array('url' => '/', 'success' => true, 'msg' => 'Successfully logout'));
 }
Пример #27
0
 public function getPaymentStatus()
 {
     // Get the payment ID before session clear
     $payment_id = \Session::get('paypal_payment_id');
     // clear the session payment ID
     \Session::forget('paypal_payment_id');
     $payerId = \Input::get('PayerID');
     $token = \Input::get('token');
     if (empty($payerId) || empty($token)) {
         return \Redirect::route('home')->with('message', 'Hubo un problema al intentar pagar con Paypal');
     }
     $payment = Payment::get($payment_id, $this->_api_context);
     $execution = new PaymentExecution();
     $execution->setPayerId(\Input::get('PayerID'));
     $result = $payment->execute($execution, $this->_api_context);
     if ($result->getState() == 'approved') {
         $this->saveOrder();
         \Session::forget('cart');
         return \Redirect::route('home')->with('message', 'Compra realizada de forma correcta');
     }
     return \Redirect::route('home')->with('message', 'La compra fue cancelada');
 }
Пример #28
0
 public function completePayment(Request $request, SlackHandler $slacker)
 {
     // Set your secret key: remember to change this to your live secret key in production
     // See your keys here https://dashboard.stripe.com/account/apikeys
     Stripe::setApiKey(env('STRIPE_SK'));
     // Get the credit card details submitted by the form
     $token = $request->input('stripeToken');
     // dd(\Session::get('cart_id'));
     if (!\Session::get('cart_id')) {
         return redirect()->route('alreadyPaid');
     }
     if (\App\Shipping::where('cart_id', \Session::get('cart_id'))->pluck('payment_status') == 'Paid') {
         return redirect()->route('alreadyPaid');
     }
     // $charge = 0;
     // $cart->checkoutPrice()
     // Create the charge on Stripe's servers - this will charge the user's card
     try {
         $charge = Charge::create(array("amount" => round($this->getCheckoutPrice()), "currency" => "usd", "source" => $token, "description" => \Session::get('cart_id')));
     } catch (\Stripe\Error\Card $e) {
         // The card has been declined
     }
     $cart_id = \Session::get('cart_id');
     $markPaid = \App\Shipping::where('cart_id', \Session::get('cart_id'))->first();
     $markPaid->payment_status = 'Paid';
     $markPaid->shipped_status = 'Not Shipped';
     $markPaid->save();
     $slacker->sendSaleMessage();
     \App\Sale::create(array('customer_id' => $markPaid->email, 'cart_id' => \Session::get('cart_id')));
     $purge = [];
     foreach (\App\Cart::where('customer_id', $cart_id)->get() as $purgeCarts) {
         $purge[] = $purgeCarts;
         $inventory = \App\Inventory::where('product_id', $purgeCarts->product_id)->pluck($purgeCarts->size);
         $newsize = $inventory - $purgeCarts->quantity;
         \DB::table('inventories')->where('product_id', $purgeCarts->product_id)->update(array($purgeCarts->size => $newsize));
     }
     if (env('APP_ENV') == 'local') {
         \Mail::send('emails.productshipped', array('cart' => \App\Cart::where('customer_id', $cart_id)->get(), 'customer' => \App\Shipping::where('cart_id', $cart_id)->first()), function ($message) {
             $message->to(\App\Shipping::where('cart_id', \Session::get('cart_id'))->pluck('email'))->subject("Your Eternally Nocturnal Order");
         });
     } else {
         \Mail::send('emails.productshipped', array('cart' => \App\Cart::where('customer_id', $cart_id)->get(), 'customer' => \App\Shipping::where('cart_id', $cart_id)->first()), function ($message) {
             $message->to(\App\Shipping::where('cart_id', \Session::get('cart_id'))->pluck('email'))->subject("Your Eternally Nocturnal Order");
         });
     }
     \Session::forget('cart_id');
     \Session::forget('checkoutAmt');
     return redirect()->route('transSuccess');
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     \Session::forget('currentSerie');
     $series = loadAllDistinctSeries();
     return view('series.home', compact('series'));
 }
Пример #30
0
 public function emptyCart()
 {
     \Session::forget('checkoutAmt');
     \Session::forget('cart_id');
     return redirect()->route('products.index');
 }