<?php

namespace App\Listeners;

use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;

class LogUserLogout
{
    /**
     * Create the event listener.
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     */
    public function handle(object $event): void
    {
        activity()
        ->causedBy($event->user)
        ->withProperties([
            'ip' => request()->ip(),
            'browser' => request()->userAgent()
        ])
        ->log('User Logout');
    }
}
