nWidart / laravel-modules

Module Management In Laravel

Home Page:https://docs.laravelmodules.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Laravel 10 and the events

chernandezosma opened this issue · comments

Hi,
I would like to give extra powers to some commands with your package, and I read about the events fired during some commands execution, at this point all it's clear, but after reading the Laravel 10 documentation, I see that now the events are working with Event classes, but the event is only text like 'enabling' but I can't see any Event class or derived from it.

My question is so simple, how could I listen the text based events using classes? How can I connect both sides?

Any clue or trick are welcome to advance in my project.

Thanks in advance and congratulations for your job and the package, it is awesome!

I found the solution and it is so simple, just declare an Event listener in EventServiceProvider as the piece of code below:

    public function boot(): void
    {
        $this->app['events']->listen('modules.*.enabling', function($event) {
            dd($event);
        });
    }