当前位置: 首页>>代码示例>>PHP>>正文


PHP Redirect::away方法代码示例

本文整理汇总了PHP中Illuminate\Support\Facades\Redirect::away方法的典型用法代码示例。如果您正苦于以下问题:PHP Redirect::away方法的具体用法?PHP Redirect::away怎么用?PHP Redirect::away使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Support\Facades\Redirect的用法示例。


在下文中一共展示了Redirect::away方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postPayment

 public function postPayment(Request $request)
 {
     $quantity = $request->get('quantity');
     $payer = new Payer();
     $payer->setPaymentMethod('paypal');
     $item_1 = new Item();
     $item_1->setName(trans('store.paypal.item_name1') . env('PAYPAL_POINTS_PER_DOLLAR', 1000) . trans('store.paypal.item_name2'))->setCurrency('USD')->setQuantity($quantity)->setPrice('1');
     // unit price
     // add item to list
     $item_list = new ItemList();
     $item_list->setItems([$item_1]);
     $amount = new Amount();
     $amount->setCurrency('USD')->setTotal($quantity);
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setItemList($item_list)->setDescription('Your transaction description');
     $redirect_urls = new RedirectUrls();
     $redirect_urls->setReturnUrl(URL::route('payment.status'))->setCancelUrl(URL::route('payment.status'));
     $payment = new Payment();
     $payment->setIntent('Sale')->setPayer($payer)->setRedirectUrls($redirect_urls)->setTransactions([$transaction]);
     try {
         $payment->create($this->_api_context);
     } catch (\PayPal\Exception\PPConnectionException $ex) {
         if (\Config::get('app.debug')) {
             echo 'Exception: ' . $ex->getMessage() . PHP_EOL;
             $err_data = json_decode($ex->getData(), true);
             exit;
         } else {
             die('Some error occur, sorry for inconvenient');
         }
     }
     foreach ($payment->getLinks() as $link) {
         if ($link->getRel() == 'approval_url') {
             $redirect_url = $link->getHref();
             break;
         }
     }
     // add payment ID to session
     Session::put('paypal_payment_id', $payment->getId());
     Session::save();
     if (isset($redirect_url)) {
         // redirect to paypal
         return Redirect::away($redirect_url);
     }
     return Redirect::route('original.route')->with('error', 'Unknown error occurred');
 }
开发者ID:softsolution,项目名称:antVel,代码行数:45,代码来源:PaypalController.php

示例2: postAddScara

 public function postAddScara($id_imobil)
 {
     $rules = array('scara' => 'required', 'asociatie' => 'required|integer|min:0');
     $errors = array('required' => 'Campul este obligatoriu.');
     $validator = Validator::make(Input::all(), $rules, $errors);
     if ($validator->fails()) {
         return Redirect::back()->with('message', 'Eroare validare formular!')->withErrors($validator)->withInput();
     } else {
         try {
             DB::table('scara_imobil')->insertGetId(array('scara' => strtoupper(Input::get('scara')), 'observatii' => Input::get('observatii'), 'id_ap' => intval(Input::get('asociatie')), 'id_imobil' => intval($id_imobil)));
         } catch (Exception $e) {
             return Redirect::back()->with('message', 'Eroare salvare date: ' . $e)->withInput();
         }
         if (Session::has('callback')) {
             return Redirect::away(Session::get('callback'));
         } else {
             return Redirect::route('scari_list', $id_imobil);
         }
     }
 }
开发者ID:binaryk,项目名称:lareab,代码行数:20,代码来源:ScaraImobilController.php

示例3: completionFailurePayment

 public function completionFailurePayment()
 {
     return Redirect::away('http://angular.gritwings.com/#/user-dashboard?a=active-assignments&payment=failure');
     //        return Redirect::away('http://localhost:3000/#/user-dashboard?a=active-assignments&payment=failure');
 }
开发者ID:Scaledesk,项目名称:gritwings,代码行数:5,代码来源:AssignmentController.php

示例4: register

 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');
 }
开发者ID:jmgolz,项目名称:php-laravel-blog,代码行数:7,代码来源:Front.php

示例5: logout

 /**
  * Logging out the current user
  */
 public function logout()
 {
     Auth::logout();
     return Redirect::away('/');
 }
开发者ID:manishdwibedy,项目名称:SCaller,代码行数:8,代码来源:LoginController.php

示例6: clear_cart

 public function clear_cart()
 {
     Cart::destroy();
     return Redirect::away('cart');
 }
开发者ID:addeye,项目名称:laravelshop,代码行数:5,代码来源:Front.php

示例7: store

 public function store()
 {
     $getid = Events::select('EventID')->get();
     if (!$getid->isEmpty()) {
         $getid = Events::select('EventID')->orderBy('EventID', 'desc')->first()->get();
         foreach ($getid as $key) {
             $id = (int) $key->EventID + 1;
         }
     } else {
         $id = 1;
     }
     $result = Request::all();
     $quoteID = $result['quoteid'];
     $eventType = $result['eventType'];
     $downpayment = $result['downpayment'];
     $userID = Auth::user()->id;
     $addedDate = date('Y-m-d H:i:s');
     try {
         /*
          * Insert the new Quote to Database Table 'quote_requests'
          */
         $events = new Events();
         $events->EventID = $id;
         $events->QuoteID = $quoteID;
         $events->UserID = $userID;
         $events->EventType = $eventType;
         $events->AddedDate = $addedDate;
         $events->save();
         Quote_Requests::where('id', $quoteID)->update(['Status' => 'Paid']);
     } catch (QueryException $e) {
     }
     // ### Address
     // Base Address object used as shipping or billing
     // address in a payment. [Optional]
     $addr = Paypalpayment::address();
     $addr->setLine1("22/1, Nagavihara Road");
     $addr->setLine2("Pitakotte");
     $addr->setCity("Pitakotte");
     $addr->setState("");
     $addr->setPostalCode("10100");
     $addr->setCountryCode("SL");
     $addr->setPhone("0094773685526");
     // ### CreditCard
     $card = Paypalpayment::creditCard();
     $card->setType("visa")->setNumber("4758411877817150")->setExpireMonth("05")->setExpireYear("2019")->setCvv2("456")->setFirstName("Hasitha")->setLastName("Jayasinghe");
     // ### FundingInstrument
     // A resource representing a Payer's funding instrument.
     // Use a Payer ID (A unique identifier of the payer generated
     // and provided by the facilitator. This is required when
     // creating or using a tokenized funding instrument)
     // and the `CreditCardDetails`
     $fi = Paypalpayment::fundingInstrument();
     $fi->setCreditCard($card);
     // ### Payer
     // A resource representing a Payer that funds a payment
     // Use the List of `FundingInstrument` and the Payment Method
     // as 'credit_card'
     $payer = new Payer();
     $payer->setPaymentMethod('paypal');
     $item_1 = new Item();
     $item_1->setName('Quote ID: ' . $quoteID)->setCurrency('USD')->setQuantity(1)->setPrice($downpayment);
     // unit price
     // add item to list
     $item_list = new ItemList();
     $item_list->setItems(array($item_1));
     $amount = new Amount();
     $amount->setCurrency('USD')->setTotal($downpayment);
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setItemList($item_list)->setDescription('Your transaction description');
     // ### Payment
     // A Payment Resource; create one using
     // the above types and intent as 'sale'
     $redirect_urls = new RedirectUrls();
     $redirect_urls->setReturnUrl(URL::route('payment-status'))->setCancelUrl(URL::route('payment-status'));
     $payment = new Payment();
     $payment->setIntent('order')->setPayer($payer)->setRedirectUrls($redirect_urls)->setTransactions(array($transaction));
     try {
         // ### Create Payment
         // Create a payment by posting to the APIService
         // using a valid ApiContext
         // The return object contains the status;
         $payment->create($this->_apiContext);
     } catch (\PPConnectionException $ex) {
         return "Exception: " . $ex->getMessage() . PHP_EOL;
         exit(1);
     }
     foreach ($payment->getLinks() as $link) {
         if ($link->getRel() == 'approval_url') {
             $redirect_url = $link->getHref();
             break;
         }
     }
     // add payment ID to session
     Session::put('paypal_payment_id', $payment->getId());
     if (isset($redirect_url)) {
         // redirect to paypal
         return Redirect::away($redirect_url);
     }
     return Redirect::route('original-route')->with('error', 'Unknown error occurred');
     dd($payment);
//.........这里部分代码省略.........
开发者ID:gayankalhara,项目名称:planmyevent,代码行数:101,代码来源:PaymentController.php

示例8: onSuccess

 /**
  * Redirect the user to the account they wish to switch too.
  *
  * @param string $redirectUrl
  *
  * @return mixed
  */
 public function onSuccess($redirectUrl)
 {
     return Redirect::away($redirectUrl);
 }
开发者ID:kamaroly,项目名称:shift,代码行数:11,代码来源:AccountSwitcherResponder.php


注:本文中的Illuminate\Support\Facades\Redirect::away方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。