From aa122a394d7b2b53d185f491d2c4afc042f61ff0 Mon Sep 17 00:00:00 2001 From: Wisp X Date: Tue, 22 Feb 2022 15:31:23 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E7=94=BB=E5=BB=8A=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/Install.php | 1 - app/Http/Middleware/CheckIsInstalled.php | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/Install.php b/app/Console/Commands/Install.php index 0d97262c..52b05f44 100644 --- a/app/Console/Commands/Install.php +++ b/app/Console/Commands/Install.php @@ -5,7 +5,6 @@ namespace App\Console\Commands; use Illuminate\Console\Command; use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Config; -use Illuminate\Support\Facades\DB; class Install extends Command { diff --git a/app/Http/Middleware/CheckIsInstalled.php b/app/Http/Middleware/CheckIsInstalled.php index 09189f2c..cd26d197 100644 --- a/app/Http/Middleware/CheckIsInstalled.php +++ b/app/Http/Middleware/CheckIsInstalled.php @@ -14,7 +14,11 @@ class CheckIsInstalled { // 检测程序是否安装 if (! file_exists(base_path('installed.lock'))) { - return redirect('install'); + if (! $request->expectsJson()) { + return redirect('install'); + } else { + return $this->error('It has already been installed.'); + } } return $next($request);