| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentBooking\App\Hooks\Handlers; |
| 4 |
|
| 5 |
use FluentBooking\App\Models\Booking; |
| 6 |
use FluentBooking\App\Models\CalendarSlot; |
| 7 |
|
| 8 |
class IntegrationHandlers |
| 9 |
{ |
| 10 |
public function boot() |
| 11 |
{ |
| 12 |
add_action('fluent_booking/after_booking_scheduled', array($this, 'pushScheduledToQueue'), 10, 2); |
| 13 |
add_action('fluent_booking/run_booking_integrations_for_scheduled', [$this, 'runForScheduledIntegrations'], 10, 2); |
| 14 |
} |
| 15 |
|
| 16 |
public function pushScheduledToQueue($booking, $slot) |
| 17 |
{ |
| 18 |
as_enqueue_async_action('fluent_booking/run_booking_integrations_for_scheduled', [ |
| 19 |
$booking->id, |
| 20 |
$slot->id |
| 21 |
], 'fluent-booking'); |
| 22 |
} |
| 23 |
|
| 24 |
public function runForScheduledIntegrations($bookingId, $slotId) |
| 25 |
{ |
| 26 |
$booking = Booking::find($bookingId); |
| 27 |
$slot = CalendarSlot::find($slotId); |
| 28 |
|
| 29 |
if (!$booking || !$slot) { |
| 30 |
return; |
| 31 |
} |
| 32 |
|
| 33 |
// We will run the integrations for the calendar |
| 34 |
|
| 35 |
} |
| 36 |
} |
| 37 |
|