blessing-skin-server/app/Listeners/NotifyFailedPlugin.php
2020-03-11 22:31:45 +08:00

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