本文整理汇总了PHP中Redirect::away方法的典型用法代码示例。如果您正苦于以下问题:PHP Redirect::away方法的具体用法?PHP Redirect::away怎么用?PHP Redirect::away使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Redirect
的用法示例。
在下文中一共展示了Redirect::away方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getStart
function getStart($method = 'shopify', $shop = '', $id = 0)
{
$api = $this->integrationMethods->getMethodClass($method);
$api->prepareAuth();
\Session::put('integration_id', $id);
return \Redirect::away($api->generateAuthUrl($shop));
}
示例2: login
/**
* 3rd party (redirect) OAuth based authentication
*
* @return \Illuminate\Http\RedirectResponse
*/
public function login()
{
$request_token_url = $this->build_url(self::F1_REQUEST_TOKEN_PATH);
$request_token = $this->oauthClient->getRequestToken($request_token_url);
$this->storeRequestToken($request_token);
$login_url = $this->build_url(self::F1_PORTAL_LOGIN_PATH) . '?oauth_token=' . $request_token['oauth_token'] . '&oauth_callback=' . url(route('login'));
return \Redirect::away($login_url);
}
示例3: postPayment
public function postPayment()
{
$payer = new Payer();
$payer->setPaymentMethod('paypal');
// $item_1 = new Item();
// $item_1->setName('Item 1') // item name
// ->setCurrency('PHP')
// ->setQuantity('1')
// ->setPrice('0.01'); // unit price
$package1 = Input::get('packname');
$amount1 = Input::get('amount');
$item_1 = new Item();
$item_1->setName($package1)->setCurrency('PHP')->setQuantity('1')->setPrice($amount1);
// unit price
// add item to list
$item_list = new ItemList();
$item_list->setItems(array($item_1));
$amount = new Amount();
$amount->setCurrency('PHP')->setTotal($package1);
$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(array($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');
// }
// }
try {
$payment->create($this->_api_context);
} catch (PayPal\Exception\PayPalConnectionException $e) {
echo $e->getData();
// This will print a JSON which has specific details about the error.
exit;
}
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');
}
示例4: getKibana
/** @inheritdoc */
public function getKibana()
{
$url = env('DFE_AUDIT_CLIENT_HOST') ? env('DFE_AUDIT_CLIENT_HOST') : env('DFE_AUDIT_HOST');
$url .= ':' . (env('DFE_AUDIT_CLIENT_PORT') ? env('DFE_AUDIT_CLIENT_PORT') : '5601');
if (strpos($url, 'http') === false) {
$url = env('DFE_DEFAULT_DOMAIN_PROTOCOL') . '://' . $url;
}
return \Redirect::away($url);
}
示例5: authenticated
protected function authenticated($request, $user)
{
$continue = \Input::get('continue');
if ($continue) {
return \Redirect::away($continue);
} else {
return redirect()->intended($this->redirectPath());
}
}
示例6: postPayment
public function postPayment()
{
$payer = new Payer();
$payer->setPaymentMethod('paypal');
$items = array();
$subtotal = 0;
$cart = \Session::get('cart');
$currency = 'MXN';
foreach ($cart as $producto) {
$item = new Item();
$item->setName($producto->name)->setCurrency($currency)->setDescription($producto->extract)->setQuantity($producto->quantity)->setPrice($producto->price);
$items[] = $item;
$subtotal += $producto->quantity * $producto->price;
}
$item_list = new ItemList();
$item_list->setItems($items);
//costo de envio de la compra
$details = new Details();
$details->setSubtotal($subtotal)->setShipping(100);
//total de envio sumando el subtotal mas el envio
$total = $subtotal + 100;
$amount = new Amount();
$amount->setCurrency($currency)->setTotal($total)->setDetails($details);
$transaction = new Transaction();
$transaction->setAmount($amount)->setItemList($item_list)->setDescription('Pedido de prueba con laravel para La Central Mueblera');
//la ruta para direccionar si se cancela o se envia conrectamente el pedido
$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(array($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('Ups! Algo salió mal');
}
}
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('cart-show')->with('error', 'Ups! Error desconocido.');
}
示例7: facebookSqueeb
public function facebookSqueeb($id)
{
//update the number of shared times
$squeeb = Lecture::where('id', '=', $id);
if ($squeeb->count()) {
$squeeb = $squeeb->first();
if ($squeeb->save()) {
return Redirect::away('https://www.facebook.com/sharer.php?u={{URL::current()}}');
}
}
}
示例8: postPayment
public function postPayment()
{
$name = 'Transaction';
/*$mmnumber = Input::get('number');
$amounttosend = Input::get('amount');
$currency = Input::get('currency');*/
$mmnumber = Input::get('number');
$amounttosend = Input::get('amount');
$currency = Input::get('currency');
$charges = new PlatformCharges($amounttosend, $currency);
$payer = new Payer();
$payer->setPaymentMethod('paypal');
$item_1 = new Item();
$item_1->setName('Transaction')->setCurrency('USD')->setQuantity(1)->setPrice((int) $charges->getDueAmountForPayPalToMobileMoney());
// unit price
// add item to list
$item_list = new ItemList();
$item_list->setItems(array($item_1));
$amount = new Amount();
$amount->setCurrency('USD')->setTotal((int) $charges->getDueAmountForPayPalToMobileMoney());
$transaction = new Transaction();
$transaction->setAmount($amount)->setItemList($item_list)->setDescription('Send money To a Mobile Money User');
$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(array($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 occurred, 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());
if (isset($redirect_url)) {
// redirect to paypal
return Redirect::away($redirect_url);
}
return "Error!!!!";
/*Redirect::route('original.route')
->with('error', 'Unknown error occurred'); */
}
示例9: postPayment
public function postPayment()
{
$payer = new Payer();
$payer->setPaymentMethod('paypal');
$item_1 = new Item();
$item_1->setName('Item 1')->setCurrency('USD')->setQuantity(2)->setPrice('150');
// unit price
$item_2 = new Item();
$item_2->setName('Item 2')->setCurrency('USD')->setQuantity(4)->setPrice('70');
$item_3 = new Item();
$item_3->setName('Item 3')->setCurrency('USD')->setQuantity(1)->setPrice('20');
// add item to list
$item_list = new ItemList();
$item_list->setItems(array($item_1, $item_2, $item_3));
$amount = new Amount();
$amount->setCurrency('USD')->setTotal(580);
$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(array($transaction));
try {
$payment->create($this->_api_context);
// echo'hello';
// print_r($test);die;
} 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');
}
}
if (is_array($payment->getLinks()) || is_object($payment->getLinks())) {
foreach ($payment->getLinks() as $link) {
echo 'reached';
if ($link->getRel() == 'approval_url') {
$redirect_url = $link->getHref();
break;
}
}
}
// add payment ID to session
Session::put('paypal_payment_id', $payment->getId());
dd(Session::all());
if (isset($redirect_url)) {
// redirect to paypal
return Redirect::away($redirect_url);
}
return Redirect::route('original.route')->with('error', 'Unknown error occurred');
}
示例10: insert_or_update
function insert_or_update($page_name, $mode = '+')
{
$page = unref(Page::import($page_name));
if ($r = $this->user_accessibility($page, $mode)) {
return $r;
}
$table_values = Input::get('v');
if ($mode == '.') {
$input_d_1 = Input::get('d');
}
foreach ($table_values as $table_name => $values) {
$table = $page->table($table_name);
$res = FALSE;
foreach ($values as $col_name => $col_value) {
if (isset($col_value['null'])) {
$res1 = $table->col($col_name)->set_client_value($new_value = NULL);
} else {
$res1 = $table->col($col_name)->set_client_value($new_value = $col_value['value']);
}
if (!$res) {
$res = $res1;
}
if ($mode == '.' && isset($input_d_1[$table_name][$col_name])) {
$input_d_1[$table_name][$col_name] = $new_value;
}
}
if ($res) {
if ($mode == '+') {
$res = $table->insert_from_client_values();
if ($res) {
return \Redirect::back()->with('message_type', 'success')->with('message', 'Successfully Saved!')->with('other_data', ['opener_refresh' => true]);
}
} else {
if ($mode == '.') {
$input_d = Input::get('d');
if (!$input_d[$table_name]) {
return view('panel.errors.5xx', ['msg' => 'Table with no primary keys cannot be updated!']);
}
$res = $table->update_from_client_values_and_edit_args($input_d[$table_name]);
if ($res) {
return \Redirect::away(action('PageController@getEdit', [$page_name]) . '?' . http_build_query(['d' => $input_d_1]))->with('message_type', 'success')->with('message', 'Successfully Saved!')->with('other_data', ['opener_refresh' => true]);
} else {
return \Redirect::away(action('PageController@getEdit', [$page_name]) . '?' . http_build_query(['d' => $input_d_1]))->with('message_type', 'warning')->with('message', 'Nothing to save!');
}
}
}
} else {
return \Redirect::back()->with('message_type', 'warning')->with('message', 'Nothing to save!');
}
return \Redirect::back()->with('message_type', 'danger')->with('message', 'Cannot Save! Some error has occurred!');
}
}
示例11: postPayment
public function postPayment()
{
$payer = new Payer();
$payer->setPaymentMethod('paypal');
$items = array();
$subtotal = 0;
$cart = \Session::get('cart');
$currency = 'USD';
foreach ($cart as $producto) {
$item = new Item();
$item->setName($producto->tipograno)->setCurrency($currency)->setDescription($producto->descripcion)->setQuantity($producto->cantidad)->setPrice($producto->precio);
$items[] = $item;
$subtotal += $producto->cantidad * $producto->precio;
}
$item_list = new ItemList();
$item_list->setItems($items);
$total = $subtotal;
$amount = new Amount();
$amount->setCurrency($currency)->setTotal($total);
$transaction = new Transaction();
$transaction->setAmount($amount)->setItemList($item_list)->setDescription('Pedido de prueba en Agricola Grain App');
$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(array($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('Ups! Algo salió mal');
}
}
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('cart-show')->with('error', 'Ups! Error desconocido.');
}
示例12: getRedirect
public function getRedirect($username, $id)
{
$link = Link::where('id', '=', $id)->first();
/*Get user ip address*/
$ip_address = $_SERVER['REMOTE_ADDR'];
$device = Device::where('ip', '=', $ip_address);
if (!$device->count()) {
//record the device
$user = Device::create(array('ip' => $ip_address));
$link->clicks = $link->clicks + 1;
$link_save = $link->save();
}
return Redirect::away($link->link_name);
}
示例13: pay
public function pay()
{
#dd(Input::all());
$payer = new Payer();
$payer->setPaymentMethod('paypal');
$counter = 0;
$items = [];
foreach (Input::all() as $input) {
if (Input::has('item_name' . $counter)) {
$item = new Item();
$item->setName(Input::get('item_name' . $counter))->setCurrency('EUR')->setQuantity(Input::get('item_qtt' . $counter))->setPrice(Input::get('item_price' . $counter));
$items[] = $item;
}
$counter++;
}
$item_list = new ItemList();
$item_list->setItems($items);
$amount = new Amount();
$amount->setCurrency('EUR')->setTotal(Input::get('total'));
$transaction = new Transaction();
$transaction->setAmount($amount)->setItemList($item_list)->setDescription('This is just a demo transaction');
$redirect_url = new RedirectUrls();
$redirect_url->setReturnUrl(URL::route('paymentStatus'))->setCancelUrl(URL::route('paymentStatus'));
$payment = new Payment();
$payment->setIntent('sale')->setPayer($payer)->setRedirectUrls($redirect_url)->setTransactions(array($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());
if (isset($redirect_url)) {
// redirect to paypal
return Redirect::away($redirect_url);
}
return Redirect::route('original.route')->with('error', 'Unknown error occurred');
}
示例14: postPayment
public function postPayment()
{
$payer = new Payer();
$payer->setPaymentMethod('paypal');
$items = array();
$subtotal = 0;
$cart = \Session::get('product');
$currency = 'USD';
$item = new Item();
$item->setName($cart->name)->setCurrency($currency)->setDescription($cart->description)->setQuantity(1)->setPrice($cart->price);
$items[] = $item;
$subtotal += $cart->price;
$item_list = new ItemList();
$item_list->setItems($items);
$details = new Details();
$details->setSubtotal($subtotal)->setShipping(0);
$total = $subtotal + 0;
$amount = new Amount();
$amount->setCurrency($currency)->setTotal($total)->setDetails($details);
$transaction = new Transaction();
$transaction->setAmount($amount)->setItemList($item_list)->setDescription('Order plan in hdsports.in');
$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(array($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('Ups! something went wrong');
}
}
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::to('/')->with('message', 'Ups! Unknown mistake.');
}
示例15: postPayment
public function postPayment()
{
// echo '123123';exit;
$payer = new Payer();
$payer->setPaymentMethod('paypal');
$total = Input::get('total');
$qty = Input::get('qty');
$price = Input::get('price');
$bill_id = Input::get('bill_id');
$item_1 = new Item();
$item_1->setName(Input::get('service_name'))->setCurrency('USD')->setQuantity($qty)->setPrice($price);
// unit price
// add item to list
$item_list = new ItemList();
$item_list->setItems(array($item_1));
$amount = new Amount();
$amount->setCurrency('USD')->setTotal($total);
$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(array($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::put('bill_id', $bill_id);
if (isset($redirect_url)) {
// redirect to paypal
return Redirect::away($redirect_url);
}
return Redirect::route('original.route')->with('error', 'Unknown error occurred');
}