I would like to have a set of Event::listen()
s in a separate file, this is what I have done so far.
bootstrap/autoload.php
...
require __DIR__.'/../bootstrap/listeners.php';
bootstrap/listeners.php
<?php
use \Event;
Event::listen('illuminate.query', function($query) {
dd($query);
});
The error is class Event not found
What is the right way for my requirement? I'm not sure creating a new .php file and require it from bootstrap/autoload.php is the right way for this requirement or not.
Please help. Thanks