本文整理汇总了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');
}
示例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);
}
}