Your cart is empty!
Preferred Stay Time
public function onUsePreferredStayTime( int $stayTime, mixed $search ) : int
Fires while calculating the stay time to use for restaurant reservations.
Description
This filter can be used to alter at runtime the preferred stay time to use while booking a table.
It is possible to fetch the booking details by using $search->get($key) method, where $key can assume all the following values:
- date (string) - The check-in date, displayed with the preferred format.
- hour (int) - The check-in hours (24h format).
- min (int) - The check-in minutes.
- people (int) - The selected number of participants.
- room (int|null) - The room ID, when explicitly selected.
Parameters
- $stayTime
-
(int) The current default value.
- $search
-
(VREAvailabilitySearch) The instance holding the booking details.
Return Value
Integer. The preferred stay time.
Example
The example below uses a different stay time depending on the check-in hour.
/**
* Trigger an event to allow third-party plugins to alter the stay time at runtime.
*
* @param int $stayTime The current default value.
* @param VREAvailabilitySearch $search The instance holding the booking details.
*
* @return int The preferred stay time.
*/
public function onUsePreferredStayTime($stayTime, $search)
{
if ($search->get('hour') < 17) {
// reduce the stay time in case we are at lunch
return 60;
}
// use default stay time
return $stayTime;
}
Changelog
| Version | Description |
|---|---|
| 1.11 | Introduced. |
Last Update: 2 days ago.
Helpful?