blessing-skin-server/app/Listeners/NotifyFailedPlugin.php

26 lines
753 B
PHP
Raw Normal View History

2019-08-31 09:12:51 +08:00
<?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>');
});
}
}
}