I'm working on a Laravel 8 project, and have a Laravel Lumen 8 project sitting along side my Laravel project. Both connect to the same database, and the database has the jobs
and failed_jobs
table.
Ideally, I want to simply dispatch an Event from my Laravel project and have my smaller, microservice Laravel Lumen project listen for this event in some way and process it and save something back to my database.
I've generated an Event called RedirectWatcher
in my Laravel project and need a LogRedirect
listener in my Lumen project to process this and save an entry to the DB.
My issue is that I have to register both the event and listener in both projects, like:
protected $listen = [
'App\Events\ExampleEvent' => [
'App\Listeners\ExampleListener',
],
];
And the event wouldn't exist in the Lumen project.
What's the best way to handle this without duping code?