HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/vebon.komma.pro/app/Listeners/saveSearchDataOnDebtorSearch.php
<?php

namespace App\Listeners;

use App\Events\SearchDebtors;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use KommaApp\Stats\StatsService;

class SaveSearchDataOnDebtorSearch implements ShouldQueue
{
    private $statsService;

    /**
     * Create the event listener.
     *
     * @param StatsService $statsService
     * @return void
     */
    public function __construct(StatsService $statsService)
    {
        $this->statsService = $statsService;
    }

    /**
     * Handle the event.
     *
     * @param  SearchDebtors $event
     * @return void
     */
    public function handle(SearchDebtors $event)
    {
        //use the statsService to save the search statistics, with the search term, found debtors and the current customer
        $this->statsService->saveSearchStats($event->search_term, $event->debtors, $event->customer);
    }
}