Viewing file: EventServiceProvider.php (1.39 KB) -rw-rw-rw- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php namespace Prettus\Repository\Providers;
use Illuminate\Support\ServiceProvider;
/** * Class EventServiceProvider * @package Prettus\Repository\Providers * @author Anderson Andrade <contato@andersonandra.de> */ class EventServiceProvider extends ServiceProvider {
/** * The event handler mappings for the application. * * @var array */ protected $listen = [ 'Prettus\Repository\Events\RepositoryEntityCreated' => [ 'Prettus\Repository\Listeners\CleanCacheRepository' ], 'Prettus\Repository\Events\RepositoryEntityUpdated' => [ 'Prettus\Repository\Listeners\CleanCacheRepository' ], 'Prettus\Repository\Events\RepositoryEntityDeleted' => [ 'Prettus\Repository\Listeners\CleanCacheRepository' ] ];
/** * Register the application's event listeners. * * @return void */ public function boot() { $events = app('events');
foreach ($this->listen as $event => $listeners) { foreach ($listeners as $listener) { $events->listen($event, $listener); } } }
/** * {@inheritdoc} */ public function register() { // }
/** * Get the events and handlers. * * @return array */ public function listens() { return $this->listen; } }
|