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

23 lines
594 B
PHP
Raw Normal View History

2019-08-31 09:12:51 +08:00
<?php
namespace App\Listeners;
2020-03-10 15:12:03 +08:00
use App\Models\User;
2020-03-11 22:31:45 +08:00
use Event;
2019-08-31 09:12:51 +08:00
class NotifyFailedPlugin
{
public function handle($event)
{
$plugin = $event->plugin;
Event::listen(\App\Events\RenderingFooter::class, function ($event) use ($plugin) {
2020-03-10 15:12:03 +08:00
/** @var User */
$user = auth()->user();
if ($user && $user->isAdmin()) {
2020-03-10 15:12:03 +08:00
$message = trans('errors.plugins.boot', ['plugin' => trans($plugin->title)]);
$event->addContent("<script>blessing.notify.toast.error('$message')</script>");
}
});
2019-08-31 09:12:51 +08:00
}
}