本文整理汇总了PHP中Payment::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Payment::orderBy方法的具体用法?PHP Payment::orderBy怎么用?PHP Payment::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Payment
的用法示例。
在下文中一共展示了Payment::orderBy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendPayment
public function sendPayment()
{
$data = array();
// if ($x = Booking::find(Booking::max('id'))) {
// $data['reference_number'] = ++$x->reference_number;
// } else {
// $data['reference_number'] = 10000000;
// }
// $reference_number = $data['reference_number'];
$data = array('details' => 'thilina', 'ip_address' => $_SERVER['REMOTE_ADDR'], 'amount' => 0.1, 'payment_status' => 0, 'my_booking' => 2);
$reserv_id = Payment::create($data);
$data_tab_HSBC_payment = array('currency' => 'USD');
$tab_HSBC_payment_id = HsbcPayment::create($data_tab_HSBC_payment);
$stamp = strtotime("now");
$payment_id = Payment::orderBy('created_at', 'desc')->first()->id;
$orderid = "{$stamp}" . 'B' . "{$payment_id}";
$last_res_resid = str_replace(".", "", $orderid);
$hsbc_id = HsbcPayment::orderBy('created_at', 'desc')->first()->id;
$hsbc_payment_id_pre = "{$stamp}" . 'HSBC' . "{$hsbc_id}";
$hsbc_payment_id = str_replace(".", "", $hsbc_payment_id_pre);
if ($last_res_resid) {
$payment = DB::table('payments')->where('id', $payment_id)->update(array('reference_number' => $last_res_resid, 'HSBC_payment_id' => $hsbc_payment_id));
$data_tab_HSBC_payment = DB::table('hsbc_payments')->where('id', $hsbc_id)->update(array('HSBC_payment_id' => $hsbc_payment_id));
}
$amount = Input::get('amount');
Session::put('payment_amount', $amount);
// $hsbc_payment_id = 1000;
$currency = 'USD';
$total_price_all_hsbc = 0.1 * 100;
// $last_res_resid = 101;
//dd($hsbc_payment_id.'/'.$currency.'/'.$total_price_all_hsbc.'/'.$last_res_resid);
HsbcPayment::goto_hsbc_gateway($hsbc_payment_id, $currency, $total_price_all_hsbc, $last_res_resid);
}
示例2: store
/**
* Store a newly created payment in storage.
*
* @return Response
*/
public function store()
{
$data = Input::all();
$user_id = Auth::id();
$validator = Validator::make(Input::all(), array('amount' => 'required|numeric'));
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
/**
* Payments are starting from "BK" numbers
*/
if ($x = Payment::find(Payment::max('id'))) {
$y = (int) substr($x->reference_number, 2);
$data['reference_number'] = 'BK' . ++$y;
} else {
$data['reference_number'] = 'BK10000000';
}
$data['agent_id'] = User::getAgentOfUser(Auth::id());
if (Entrust::hasRole('Agent')) {
$agent_id = $data['agent_id']->user_id;
$name = User::where('id', $user_id)->first()->first_name . ' ' . User::where('id', $user_id)->first()->last_name;
$email = User::where('id', $user_id)->first()->email;
$phone = Agent::where('user_id', $user_id)->first()->phone;
$amount = Input::get('amount');
$details = Input::get('details');
$data = array('details' => $name, 'ip_address' => $_SERVER['REMOTE_ADDR'], 'amount' => $amount, 'payment_status' => 0, 'my_booking' => 2);
$reserv_id = Payment::create($data);
$data_tab_HSBC_payment = array('currency' => 'USD');
$tab_HSBC_payment_id = HsbcPayment::create($data_tab_HSBC_payment);
$stamp = strtotime("now");
$payment_id = Payment::orderBy('created_at', 'desc')->first()->id;
$orderid = "{$stamp}" . 'AP' . "{$payment_id}";
$last_res_resid = str_replace(".", "", $orderid);
$hsbc_id = HsbcPayment::orderBy('created_at', 'desc')->first()->id;
$hsbc_payment_id_pre = "{$stamp}" . 'HSBC' . "{$hsbc_id}";
$hsbc_payment_id = str_replace(".", "", $hsbc_payment_id_pre);
if ($last_res_resid) {
$payment = DB::table('payments')->where('id', $payment_id)->update(array('reference_number' => $last_res_resid, 'HSBC_payment_id' => $hsbc_payment_id));
$data_tab_HSBC_payment = DB::table('hsbc_payments')->where('id', $hsbc_id)->update(array('HSBC_payment_id' => $hsbc_payment_id));
$client = array('booking_name' => $name, 'email' => $email, 'phone' => $phone, 'remarks' => $details, 'val' => 0, 'payment_reference_number' => $last_res_resid);
$client_payment_id = Booking::create($client);
}
$currency = 'USD';
$x = $amount * 1.037;
$total_price_all_hsbc = round($x, 2) * 100;
//dd($hsbc_payment_id . '/' . $currency . '/' . $total_price_all_hsbc . '/' . $last_res_resid);
HsbcPayment::goto_hsbc_gateway($hsbc_payment_id, $currency, $total_price_all_hsbc, $last_res_resid);
// return $this->storeAllDataAndSendEmails();
}
//Payment::create($data);
return Redirect::route('accounts.payments.index');
}
示例3: store
/**
* Store a newly created booking in storage.
* This includes Clients, FlightDetails
*
* @return Response
*/
public function store()
{
if (Auth::check()) {
$user = Auth::user();
if (Entrust::hasRole('Agent')) {
$rules = Booking::$agentRules;
}
} else {
$rules = Booking::$guestRules;
}
$data = Input::all();
if (Auth::check()) {
$data['user_id'] = Auth::id();
}
$validator = Validator::make($data, $rules);
if ($validator->fails()) {
//dd($validator->errors());
return Redirect::back()->withErrors($validator)->withInput();
}
$data['val'] = 1;
if ($x = Booking::find(Booking::max('id'))) {
$data['reference_number'] = ++$x->reference_number;
} else {
$data['reference_number'] = 10000000;
}
Session::put('MyBookingData', $data);
$clients = null;
$newBooking = $this->storeAllData();
$booking_name = $newBooking->booking_name;
$booking_amount = Booking::getTotalBookingAmount($newBooking);
$data = array('details' => $booking_name, 'ip_address' => $_SERVER['REMOTE_ADDR'], 'amount' => $booking_amount, 'payment_status' => 0, 'my_booking' => 2);
$reserv_id = Payment::create($data);
$data_tab_HSBC_payment = array('currency' => 'USD');
$tab_HSBC_payment_id = HsbcPayment::create($data_tab_HSBC_payment);
$stamp = strtotime("now");
$payment_id = Payment::orderBy('created_at', 'desc')->first()->id;
$orderid = "{$stamp}" . 'A' . "{$payment_id}";
$last_res_resid = str_replace(".", "", $orderid);
$hsbc_id = HsbcPayment::orderBy('created_at', 'desc')->first()->id;
$hsbc_payment_id_pre = "{$stamp}" . 'HSBC' . "{$hsbc_id}";
$hsbc_payment_id = str_replace(".", "", $hsbc_payment_id_pre);
if ($last_res_resid) {
$payment = DB::table('payments')->where('id', $payment_id)->update(array('reference_number' => $last_res_resid, 'HSBC_payment_id' => $hsbc_payment_id));
$data_tab_HSBC_payment = DB::table('hsbc_payments')->where('id', $hsbc_id)->update(array('HSBC_payment_id' => $hsbc_payment_id));
}
$currency = 'USD';
//$x = Booking::getTotalBookingAmount($newBooking) * 100 * 1.037;
// $x = 2 * 100 * 1.037;
//$total_price_all_hsbc = round($x, 2);
$total_price_all_hsbc = $booking_amount * 100;
dd($total_price_all_hsbc);
// dd($hsbc_payment_id . '/' . $currency . '/' . $total_price_all_hsbc . '/' . $last_res_resid);
HsbcPayment::goto_hsbc_gateway($hsbc_payment_id, $currency, $total_price_all_hsbc, $last_res_resid);
}
示例4: Reports
public function Reports()
{
$collections = Payment::orderBy('created_at', 'desc')->get();
$sum = Payment::sum('amount');
return Response::json(array('collections' => $collections, 'sum' => $sum));
}