How do I make custom mail notification events?

To create an event that shows up in the Mail Notifications part of the admin your event needs to extend Aero\Events\ManagedEvent and have Aero\Events\ManagedHandler as a registered listener.

To create an event you need to create a class that extends Aero\Events\ManagedEvent.

<?php

namespace Acme\MyModule\Events;

use Aero\Events\ManagedEvent;

class MyEvent extends ManagedEvent
{
   //
}

To register Aero\Events\ManagedHandler as a listener of your event you need to add your event and the managed handler to a $listen array inside of a service provider.

<?php

namespace Acme\MyModule;

use Acme\MyModule\Events\MyEvent;
use Aero\Common\Providers\ModuleServiceProvider;
use Aero\Events\ManagedHandler;

class ServiceProvider extends ModuleServiceProvider
{
   protected $listen = [
       MyEvent::class => [
           ManagedHandler::class,
       ],
   ];

   public function setup()
   {
       //
   }
}

Articles in this section

Was this article helpful?
0 out of 0 found this helpful