本文整理匯總了PHP中app\models\Customer::addCustomer方法的典型用法代碼示例。如果您正苦於以下問題:PHP Customer::addCustomer方法的具體用法?PHP Customer::addCustomer怎麽用?PHP Customer::addCustomer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\models\Customer
的用法示例。
在下文中一共展示了Customer::addCustomer方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: anyConfirmed
/**
* Function to create the appointment, scrub the database, and send out an email confirmation
*
* User interaction is complete
*
**/
public function anyConfirmed()
{
// When this boolean is set to True, instead of deleting all appointment times for the package duration
// It will instead remove all times up to the end of the day, and continue to the next day until the package
// time is done.
$overlapDays = FALSE;
$info = Session::get('appointmentInfo');
$startTime = new DateTime($info['datetime']);
$endTime = new DateTime($info['datetime']);
date_add($endTime, date_interval_create_from_date_string($info['package_time'] . ' hours'));
$newCustomer = Customer::addCustomer();
$startTime = $startTime->format('Y-m-d H:i');
$endTime = $endTime->format('Y-m-d H:i');
// Create the appointment with this new customer id
Appointment::addAppointment($newCustomer);
if ($overlapDays) {
// Remove hours up to the last hour of the day, then continue to the next day
// If necessary
// PSEUDO CODE
// We will get the last appointment of the day and see if it's smaller than the package time
// If the last appointment occurs beyond the package duration, we delete like normal
// If the last appointment occurs before the package duration
// We subtract the hours we remove from the package duration to get remaining time
// Then we go to the next day with appointment times and remove enough appointments
// To make clearance for the package duration.
} else {
// Remove all dates conflicting with the appointment duration
BookingDateTime::timeBetween($startTime, $endTime)->delete();
}
return View::make('success');
}