blessing-skin-server/app/Listeners/NotifyFailedPlugin.php
2019-08-31 09:12:51 +08:00

26 lines
753 B
PHP

<?php
namespace App\Listeners;
use Event;
class NotifyFailedPlugin
{
public function handle($event)
{
$plugin = $event->plugin;
$user = auth()->user();
if ($user && $user->isAdmin()) {
Event::listen(\App\Events\RenderingFooter::class, function ($event) use ($plugin) {
$options = json_encode([
'type' => 'warning',
'title' => trans('errors.plugins.boot.title'),
'message' => trans('errors.plugins.boot.message', ['plugin' => trans($plugin->title)]),
'duration' => 0,
]);
$event->addContent('<script>blessing.ui.notify('.$options.')</script>');
});
}
}
}