diff --git a/app/Events/PluginWasDeleted.php b/app/Events/PluginWasDeleted.php new file mode 100644 index 00000000..75d8fed9 --- /dev/null +++ b/app/Events/PluginWasDeleted.php @@ -0,0 +1,21 @@ +plugin = $plugin; + } + +} diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index 3a55113b..a044e11c 100644 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers; use View; use Utils; use Option; +use App\Events; use App\Models\User; use App\Models\Player; use App\Models\Texture; @@ -117,14 +118,20 @@ class AdminController extends Controller switch ($request->get('action')) { case 'enable': $plugins->enable($id); + + return redirect('admin/plugins'); break; case 'disable': $plugins->disable($id); + + return redirect('admin/plugins'); break; case 'delete': if ($request->isMethod('post')) { + event(new Events\PluginWasDeleted($plugin)); + $plugins->uninstall($id); return json('插件已被成功删除', 0); diff --git a/app/Http/Middleware/CheckAuthenticated.php b/app/Http/Middleware/CheckAuthenticated.php index 4e9ca710..9c38d9bb 100644 --- a/app/Http/Middleware/CheckAuthenticated.php +++ b/app/Http/Middleware/CheckAuthenticated.php @@ -51,11 +51,11 @@ class CheckAuthenticated exit; } + event(new UserAuthenticated($user)); + if ($return_user) return $user; - event(new UserAuthenticated($user)); - return $next($request); } else { return redirect('auth/login')->with('msg', trans('auth.check.anonymous'));