本文整理汇总了PHP中app\Customer::full_name方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::full_name方法的具体用法?PHP Customer::full_name怎么用?PHP Customer::full_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Customer
的用法示例。
在下文中一共展示了Customer::full_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveCustomerReservationDetails
public static function saveCustomerReservationDetails($data)
{
//dd($data->all());
$getReferenceNumber = new Reservation();
$rooms = explode(',', $data->get('rooms'));
$customer = Customer::whereEmail($data->get('email'))->first();
$total_capacity = 0;
$total_person = $data->get('no_of_adult') + $data->get('no_of_child');
foreach ((array) $rooms as $rm) {
$rms = Room::find($rm);
$categories = Category::find($rms->category_id);
if (count($categories) > 0) {
$total_capacity += $categories->max_capacity;
}
}
if ($total_capacity < $total_person) {
return redirect()->back()->with('message', 'You exceeded the max capacity of the rooms');
} else {
if (count($customer) == 0) {
$customer = new Customer();
$customer->name = ucfirst(strtolower($data->get('first_name'))) . ' ' . ucfirst(strtolower($data->get('last_name')));
$customer->address = $data->get('address');
$customer->email = $data->get('email');
$customer->contact_number = $data->get('contact');
if ($customer->save()) {
$reservation = new Reservation();
$reservation->customer_id = $customer->id;
$reservation->reference_number = $getReferenceNumber->getReservationId();
$reservation->no_of_child = $data->get('no_of_child');
$reservation->no_of_adult = $data->get('no_of_adult');
$reservation->period = $data->get('period');
$reservation->status = 'RESERVED';
if ($reservation->save()) {
foreach ((array) $rooms as $room) {
$start_date = $data->get('start_date');
$end_date = $data->get('end_date');
# ROOM VISITOR
$start_date = date("Y-m-d", strtotime($start_date));
while (strtotime($start_date) < strtotime($end_date)) {
$reservation_room = new ReservationRoom();
$reservation_room->reservation_id = $reservation->id;
$reservation_room->room_id = $room;
$reservation_room->date_reserved = $start_date;
$reservation_room->save();
$start_date = date("Y-m-d", strtotime("+1 day", strtotime($start_date)));
}
}
}
}
Mail::send('emails.reservation_reference', ['customer' => $customer, 'reservation' => $reservation], function ($m) use($customer) {
$m->from('noreply@overlook-resort.com', 'Overlook Resort (noreply)');
$m->to($customer->email, $customer->full_name())->subject('Here\'s your RESERVATION ID');
});
return redirect()->back()->with('message', 'Reservation was successful. We sent your reservation reference in your e-mail');
}
$reservation = new Reservation();
$reservation->customer_id = $customer->id;
$reservation->reference_number = $reservation->getReservationId();
$reservation->no_of_child = $data->get('no_of_child');
$reservation->no_of_adult = $data->get('no_of_adult');
$reservation->period = $data->get('period');
$reservation->status = 'Not Paid';
if ($reservation->save()) {
foreach ((array) $rooms as $room) {
$start_date = $data->get('start_date');
$end_date = $data->get('end_date');
# ROOM VISITOR
$start_date = date("Y-m-d", strtotime($start_date));
while (strtotime($start_date) < strtotime($end_date)) {
$reservation_room = new ReservationRoom();
$reservation_room->reservation_id = $reservation->id;
$reservation_room->room_id = $room;
$reservation_room->date_reserved = $start_date;
$reservation_room->save();
$start_date = date("Y-m-d", strtotime("+1 day", strtotime($start_date)));
}
}
}
Mail::send('emails.reservation_reference', ['customer' => $customer, 'reservation' => $reservation], function ($m) use($customer) {
$m->from('noreply@overlook-resort.com', 'Overlook Resort (noreply)');
$m->to($customer->email, $customer->full_name())->subject('Here\'s your RESERVATION ID');
});
return redirect()->back()->with('message', 'Reservation was successful. We sent your reservation reference in your e-mail');
}
}