23 lines
594 B
PHP
23 lines
594 B
PHP
<?php
|
|
|
|
namespace App\Listeners;
|
|
|
|
use App\Models\User;
|
|
use Event;
|
|
|
|
class NotifyFailedPlugin
|
|
{
|
|
public function handle($event)
|
|
{
|
|
$plugin = $event->plugin;
|
|
Event::listen(\App\Events\RenderingFooter::class, function ($event) use ($plugin) {
|
|
/** @var User */
|
|
$user = auth()->user();
|
|
if ($user && $user->isAdmin()) {
|
|
$message = trans('errors.plugins.boot', ['plugin' => trans($plugin->title)]);
|
|
$event->addContent("<script>blessing.notify.toast.error('$message')</script>");
|
|
}
|
|
});
|
|
}
|
|
}
|