blessing-skin-server/app/Listeners/NotifyFailedPlugin.php
Pig Fang bb898ea2e4 Use message to report plugin errors
Instead of `notification`
2019-09-19 23:09:53 +08:00

26 lines
722 B
PHP

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