You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created the below event listener and bound it to the QueryExecuted event.
<?php
namespace App\Listeners;
use Illuminate\Database\Events\QueryExecuted;
use Illuminate\Support\Facades\Log;
class QueryExecutedListener
{
/**
* Create the event listener.
*/
public function __construct()
{
//
}
/**
* Handle the event.
*/
public function handle(QueryExecuted $query): void
{
$message = [
'query' => $query->sql,
'bindings' => $query->bindings,
'time' => $query->time
];
Log::error(json_encode($message));
}
}
but no log is saved to the channel after a query ran.
The listener is registered successfully which I can verify with the command php artisan event:list
I created the below event listener and bound it to the QueryExecuted event.
but no log is saved to the channel after a query ran.
The listener is registered successfully which I can verify with the command
php artisan event:list
This may because in
Illuminate\Database\Connection
class functionevent()
,$this->events
is always return null.May I have a pointer how I can set the events properly?
The text was updated successfully, but these errors were encountered: