Alerts

The Alerts system (known as Events in AF) extends the standard Laravel event system to allow arbitrary actions to take place when an event is dispatched.

For a Laravel event that should provide alerts it MUST implement the ActionableEvent interface from App\Interfaces\ActionableEvent.

This simple interface defines 2 static methods for getting what variables an event provides (for templating) and for a user facing description. See the SchedulePublished event from AF for an example.

The Laravel Listener for actionable events MUST extend the \App\Interfaces\EventActionInterface class which provides a helper function for dispatching actionable events. In the handle method of the listener you must call $this->do_event_actions() with an EventType and an array of variables. The app\Models\Alerts\EventType model holds information about a specific event, so for the SchedulePublished event in AF Only variables defined in the event's interface will be templated.

The next layer is the EventActionProcessor job will be dispatched to run in the background to fufill requests.

We will need to have some kind of filtering in place to ensure users only get notifications they care about.

Alerts have an Action Type which is the delivery method for the notification. You can create a new Action Type with the artisan command make:alert-action. This will generate the Job template to send the message for you to implement and setup the Action Type in the database.

You can create a new Alert and it's listener with the command make:alert EventName. This one command will create the Event with the ActionableEvent interface implemented with a default one and the Listener extending the EventActionInterface.