3 month limit setup
This commit is contained in:
@@ -403,6 +403,20 @@ class Pages extends CI_Controller {
|
||||
]));
|
||||
return;
|
||||
}
|
||||
|
||||
$today = new DateTime();
|
||||
$maxDate = (clone $today)->modify('+3 months');
|
||||
$selectedDate = new DateTime($bookingArray['booking_date']);
|
||||
|
||||
if ($selectedDate > $maxDate) {
|
||||
$this->output
|
||||
->set_status_header(403)
|
||||
->set_content_type('application/json')
|
||||
->set_output(json_encode([
|
||||
'error' => 'Bookings can only be made up to 3 months in advance.'
|
||||
]));
|
||||
return;
|
||||
}
|
||||
|
||||
// 6. Create booking
|
||||
$this->Service_model->createBooking($bookingArray);
|
||||
|
||||
Reference in New Issue
Block a user