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


PHP Reservation::dataInsertPost方法代码示例

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


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

示例1: postPayment

 public function postPayment()
 {
     $data = array();
     if (is_array(Input::get('room_id'))) {
         foreach (Input::get('room_id') as $key => $val) {
             $data[$key] = array('am_id' => Input::get('am_id.' . $key), 'rooms' => $val);
         }
     }
     $data2 = array();
     if (is_array(Input::get('add_Am'))) {
         foreach (Input::get('add_Am') as $key => $val) {
             $data2[$key] = array('am_id' => Input::get('am_id.' . $key), 'rooms' => $val);
         }
     }
     $payer = new Payer();
     $payer->setPaymentMethod('paypal');
     $name = Input::get('packname');
     $price = Input::get('amount');
     $input_dFrom = Input::get('package_datefrom');
     $input_dTo = Input::get('package_dateto');
     $input_nPax = Input::get('num_pax');
     $input_fName = Input::get('fullN');
     $postData = new Reservation();
     $postData->dataInsertPost($name, $price, $input_dFrom, $input_dTo, $input_nPax, $input_fName, json_encode($data), 'PayPal', json_encode($data2));
     $item_1 = new Item();
     $item_1->setName($name)->setCurrency('PHP')->setQuantity('1')->setPrice(intval($price));
     // unit price
     // add item to list
     $item_list = new ItemList();
     $item_list->setItems(array($item_1));
     $amount = new Amount();
     $amount->setCurrency('PHP')->setTotal(intval($price));
     $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'));
     //        $redirect_urls->setReturnUrl(URL::to('/dashboard/accommodation'))
     //            ->setCancelUrl(URL::to('/dashboard/accommodation'));
     $payment = new Payment();
     $payment->setIntent('Sale')->setPayer($payer)->setRedirectUrls($redirect_urls)->setTransactions(array($transaction));
     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)) {
         return json_encode(['url' => $redirect_url]);
     }
     return Redirect::route('dashboard.packages.accommodation')->with('error', 'Unknown error occurred');
 }
开发者ID:axisssss,项目名称:ORS,代码行数:60,代码来源:PaypalController.php

示例2: uploadBankReceipt

 public function uploadBankReceipt()
 {
     if (Input::hasFile('uploadReceipt')) {
         $data = array();
         if (is_array(Input::get('room_id'))) {
             foreach (Input::get('room_id') as $key => $val) {
                 $data[$key] = array('am_id' => Input::get('am_id.' . $key), 'rooms' => $val);
             }
         }
         $data2 = array();
         if (is_array(Input::get('add_Am'))) {
             foreach (Input::get('add_Am') as $key => $val) {
                 $data2[$key] = array('am_id' => Input::get('am_id.' . $key), 'rooms' => $val);
             }
         }
         $name = Input::get('packname');
         $price = Input::get('amount');
         $input_dFrom = Input::get('package_datefrom');
         $input_dTo = Input::get('package_dateto');
         $input_nPax = Input::get('num_pax');
         $input_fName = Input::get('fullN');
         $postData = new Reservation();
         $postData->dataInsertPost($name, $price, $input_dFrom, $input_dTo, $input_nPax, $input_fName, json_encode($data), 'Bank', json_encode($data2));
         $lastInsert = DB::getPdo()->lastInsertId();
         $files = Input::file('uploadReceipt');
         $i = 1;
         foreach ($files as $file) {
             try {
                 $path = public_path() . '\\uploads\\bank_deposit\\';
                 $extension = $file->getClientOriginalExtension();
                 $filename = pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME);
                 $dateNow = date('Ymd_His');
                 $new_filename = Auth::user()->id . '_' . $filename . '_' . $i . '.' . $extension;
                 $upload_success = $file->move($path, $new_filename);
             } catch (Exception $ex) {
                 $path = public_path() . '/uploads/bank_deposit/';
                 $extension = $file->getClientOriginalExtension();
                 $filename = pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME);
                 $dateNow = date('Ymd_His');
                 $new_filename = Auth::user()->id . '_' . $filename . '_' . $i . '.' . $extension;
                 $upload_success = $file->move($path, $new_filename);
             }
             $insertVal = array('image_fieldvalue' => $lastInsert, 'image_name' => $new_filename);
             $this->GlobalModel->insertModel('tbl_images', $insertVal);
             $i++;
         }
         $data = array('refNumber' => str_pad($lastInsert, 10, "0", STR_PAD_LEFT), 'package' => $name, 'amount' => '₱' . number_format($price, 2), 'paymentMethod' => 'Bank Deposit', 'status' => 1);
         try {
             Mail::send('emails.user.transactionReservation', $data, function ($message) use($data) {
                 $message->from('no-reply@reservation.com', 'El Sitio Filipino');
                 $message->to(Auth::user()->user_email, Auth::user()->user_fname . ' ' . Auth::user()->user_lname)->subject('El Sitio Filipino Transaction Details');
             });
         } catch (Exception $ex) {
             dd($ex->getMessage());
         }
         return Response::json($data);
     }
 }
开发者ID:axisssss,项目名称:ORS,代码行数:58,代码来源:OrdersController.php


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