EscolaLMS/Images

View on GitHub
src/Providers/EventServiceProviders.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

namespace EscolaLms\Images\Providers;

use EscolaLms\Images\Events\File;
use EscolaLms\Images\Events\FileDeleted;
use EscolaLms\Images\Events\FileStored;
use EscolaLms\Images\Services\Contracts\ImagesServiceContract;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\ServiceProvider;

class EventServiceProviders extends ServiceProvider
{
    public function boot(): void
    {
        Event::listen([FileDeleted::class, FileStored::class], function (File $event) {
             app(ImagesServiceContract::class)->clearImageCacheByDirectory($event->getPath());
        });
    }
}