TDoG-Skin/app/Listeners/NotifyFailedPlugin.php
2024-08-17 19:13:54 +08:00

23 lines
594 B
PHP
Executable File

<?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>");
}
});
}
}