本文整理汇总了PHP中Discount::calculateDiscount方法的典型用法代码示例。如果您正苦于以下问题:PHP Discount::calculateDiscount方法的具体用法?PHP Discount::calculateDiscount怎么用?PHP Discount::calculateDiscount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Discount
的用法示例。
在下文中一共展示了Discount::calculateDiscount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clientBookingStep4
public function clientBookingStep4()
{
/*foreach(Session::get('reservation')['reservation_room'] as $rooms)
{
$count++;
$room_id = $rooms['room_details']['id'];
$available_rooms = [];
$room_qty = RoomQty::with(array('roomPrice','roomReserved'=>function($query) use($i, $room_id){
$query->where(function($query2) use ($i, $room_id){
$query2->whereBetween('check_in', array($i['checkin'], $i['checkout']))
->orWhereBetween('check_out', array($i['checkin'], $i['checkout']))
->orWhereRaw('"'.$i["checkin"].'" between check_in and check_out')
->orWhereRaw('"'.$i["checkout"].'" between check_in and check_out');
})->where(function($query3)
{
$query3->where('status', '!=', 5)->orWhere('status', '!=', 3);
});
}))->where('room_id', $room_id)->where('status',1)->get();
foreach($room_qty as $available)
{
if($available->roomReserved== '[]' || count($available->roomReserved) == 0)
{
array_push($available_rooms, $available);
}
}
if(count($available_rooms) < $rooms['quantity'])
{
return Redirect::to('booking/step2')->with('error', 'Some rooms you booked is not available');
}
} */
try {
$data = $total_price = 0;
foreach (Session::get('reservation')['reservation_room'] as $reservation) {
$total_price += $reservation['room_details']['price'];
}
if (Session::has('reservation.customerdiscount')) {
$discount = new Discount();
Session::put('reservation.customerdiscountprice', $discount->calculateDiscount(1000, Session::get('reservation')['customerdiscount']['effect'], Session::get('reservation')['customerdiscount']['effect_type']));
}
$ci = new Carbon(Session::get('reservation')['checkin']);
$co = new Carbon(Session::get('reservation')['checkout']);
$diff = $co->addMinutes(1)->diff($ci)->days;
Session::put('reservation.nights', $diff);
$cpage = 'booking.step4';
return View::make('clientview2.booking.step4', compact('cpage'));
} catch (exception $e) {
return $e;
Session::forget('reservation');
return Redirect::to('booking')->with('error', 'Something went wrong. Please try again.');
}
}