ea3ab21beb
* Refactor notifications to allow easier plugins * Notification refactoring * Formatting * Move news to NewsService; cleanup of events * More refactoring; added send email out for news item and the template * Formatting * Formatting
23 lines
449 B
PHP
23 lines
449 B
PHP
<?php
|
|
|
|
namespace App\Contracts;
|
|
|
|
use Illuminate\Contracts\Events\Dispatcher;
|
|
|
|
abstract class Listener
|
|
{
|
|
public static $callbacks = [];
|
|
|
|
/**
|
|
* Sets up any callbacks that are defined in the child class
|
|
*
|
|
* @param $events
|
|
*/
|
|
public function subscribe(Dispatcher $events): void
|
|
{
|
|
foreach (static::$callbacks as $klass => $cb) {
|
|
$events->listen($klass, get_class($this).'@'.$cb);
|
|
}
|
|
}
|
|
}
|