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