From 5d8a161f13cb1ba696b2b39f5ec7eac54f2f22a0 Mon Sep 17 00:00:00 2001 From: iamgergo Date: Sat, 30 Jan 2021 21:59:28 +0100 Subject: [PATCH] fix bugs --- src/Bazar.php | 3 +-- src/Console/Commands/InstallCommand.php | 7 +++---- src/Http/Middleware/ComponentMiddleware.php | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Bazar.php b/src/Bazar.php index 0e415a7f..8923f81c 100644 --- a/src/Bazar.php +++ b/src/Bazar.php @@ -7,7 +7,6 @@ use Bazar\Http\Middleware\ShareComponentData; use Closure; use Illuminate\Routing\Router; -use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Route; @@ -44,7 +43,7 @@ public static function version(): string */ public static function assetVersion(): ?string { - $path = App::publicPath('mix-manifest.json'); + $path = public_path('mix-manifest.json'); return is_file($path) ? md5_file($path) : null; } diff --git a/src/Console/Commands/InstallCommand.php b/src/Console/Commands/InstallCommand.php index b2544d32..83a15e1e 100644 --- a/src/Console/Commands/InstallCommand.php +++ b/src/Console/Commands/InstallCommand.php @@ -4,7 +4,6 @@ use Bazar\Database\Seeders\BazarSeeder; use Illuminate\Console\Command; -use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\File; class InstallCommand extends Command @@ -36,10 +35,10 @@ public function handle(): int $status = $this->call('db:seed', ['--class' => BazarSeeder::class]); } - File::ensureDirectoryExists(App::publicPath('vendor')); + File::ensureDirectoryExists(public_path('vendor')); - if (! is_dir(App::publicPath('vendor/bazar'))) { - symlink(__DIR__.'/../../../public', App::publicPath('vendor/bazar')); + if (! is_dir(public_path('vendor/bazar'))) { + symlink(__DIR__.'/../../../public', public_path('vendor/bazar')); } return $status; diff --git a/src/Http/Middleware/ComponentMiddleware.php b/src/Http/Middleware/ComponentMiddleware.php index eb1b400f..0c9da7cc 100644 --- a/src/Http/Middleware/ComponentMiddleware.php +++ b/src/Http/Middleware/ComponentMiddleware.php @@ -25,7 +25,7 @@ public function handle(Request $request, Closure $next) return $response; } - if ($request->isMethod('GET') && $request->header('X-Inertia-Version', '') !== Bazar::assetVersion()) { + if ($request->isMethod('GET') && $request->header('X-Inertia-Version') !== Bazar::assetVersion()) { if ($request->hasSession()) { $request->session()->reflash(); }