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;
|
2019-09-19 23:09:53 +08:00
|
|
|
Event::listen(\App\Events\RenderingFooter::class, function ($event) use ($plugin) {
|
2020-03-10 15:12:03 +08:00
|
|
|
/** @var User */
|
2019-09-19 23:09:53 +08:00
|
|
|
$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-09-19 23:09:53 +08:00
|
|
|
}
|
|
|
|
});
|
2019-08-31 09:12:51 +08:00
|
|
|
}
|
|
|
|
}
|