# fluent-booking/trunk/app/Hooks/Handlers/LogHandler.php

Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution, version trunk. 33 lines.

- Page: https://pluginprobe.com/plugins/fluent-booking/trunk/code/app/Hooks/Handlers/LogHandler.php
- Raw: https://pluginprobe.com/plugins/fluent-booking/trunk/raw/app/Hooks/Handlers/LogHandler.php
- Modified: 2024-07-16T14:25:14+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-booking/trunk/code/app/Hooks/Handlers/LogHandler.php#L10-L20`.

```php
<?php

namespace FluentBooking\App\Hooks\Handlers;

use FluentBooking\App\Models\BookingActivity;
use FluentBooking\Framework\Support\Arr;

class LogHandler
{
    public function register()
    {
        add_action('fluent_booking/log_booking_note', [$this, 'logBookingActivity'], 10);
        add_action('fluent_booking/log_booking_activity', [$this, 'logBookingActivity'], 10, 1);
    }

    public function logBookingActivity($data)
    {
        $logData = array_filter(Arr::only($data, [
            'status',
            'type',
            'title',
            'description',
            'booking_id'
        ]));

        if (!$logData || empty($logData['booking_id'])) {
            return;
        }

        BookingActivity::create($logData);
    }
}

```
