From 392888f55060268b9533d106f26a92e94c8d7c85 Mon Sep 17 00:00:00 2001 From: Pascal Baljet Date: Wed, 15 Feb 2023 15:24:06 +0100 Subject: [PATCH 1/3] Update InstallsSpladeExceptionHandler.php --- src/Commands/InstallsSpladeExceptionHandler.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Commands/InstallsSpladeExceptionHandler.php b/src/Commands/InstallsSpladeExceptionHandler.php index 5126d4ca..4d27610b 100644 --- a/src/Commands/InstallsSpladeExceptionHandler.php +++ b/src/Commands/InstallsSpladeExceptionHandler.php @@ -17,7 +17,9 @@ protected function installExceptionHandler() $exceptionHandler = file_get_contents(app_path('Exceptions/Handler.php')); - $search = 'public function register()' . $eol . ' {'; + $search = version_compare(LARAVEL_VERSION, '10.0', '>=') + ? 'public function register(): void' . $eol . ' {' + : 'public function register()' . $eol . ' {'; $registerMethodAfter = Str::after($exceptionHandler, $search); From 7776f44aca2b7fe7664a52359866bf6ad703e2ec Mon Sep 17 00:00:00 2001 From: Pascal Baljet Date: Wed, 15 Feb 2023 15:30:22 +0100 Subject: [PATCH 2/3] Update InstallsSpladeRouteMiddleware.php --- src/Commands/InstallsSpladeRouteMiddleware.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Commands/InstallsSpladeRouteMiddleware.php b/src/Commands/InstallsSpladeRouteMiddleware.php index 1f98cf25..a0136f55 100644 --- a/src/Commands/InstallsSpladeRouteMiddleware.php +++ b/src/Commands/InstallsSpladeRouteMiddleware.php @@ -15,7 +15,11 @@ protected function installRouteMiddleware() { $httpKernel = file_get_contents(app_path('Http/Kernel.php')); - $search = 'protected $routeMiddleware = [' . SpladeInstallCommand::eol(); + $eol = SpladeInstallCommand::eol(); + + $search = version_compare(app()->version(), '10.0', '>=') + ? 'protected $middlewareAliases = [' . $eol + : 'protected $routeMiddleware = [' . $eol; $routeMiddlewareAfter = Str::after($httpKernel, $search); @@ -29,7 +33,7 @@ protected function installRouteMiddleware() app_path('Http/Kernel.php'), str_replace( $routeMiddlewareAfter, - ' ' . $routeMiddleware . ',' . SpladeInstallCommand::eol() . $routeMiddlewareAfter, + ' ' . $routeMiddleware . ',' . $eol . $routeMiddlewareAfter, $httpKernel ) ); From fe4766023ae1b03cc8eb56a9c82d3e1c02161ad3 Mon Sep 17 00:00:00 2001 From: Pascal Baljet Date: Wed, 15 Feb 2023 15:31:49 +0100 Subject: [PATCH 3/3] Update InstallsSpladeExceptionHandler.php --- src/Commands/InstallsSpladeExceptionHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Commands/InstallsSpladeExceptionHandler.php b/src/Commands/InstallsSpladeExceptionHandler.php index 4d27610b..ce5416b0 100644 --- a/src/Commands/InstallsSpladeExceptionHandler.php +++ b/src/Commands/InstallsSpladeExceptionHandler.php @@ -17,7 +17,7 @@ protected function installExceptionHandler() $exceptionHandler = file_get_contents(app_path('Exceptions/Handler.php')); - $search = version_compare(LARAVEL_VERSION, '10.0', '>=') + $search = version_compare(app()->version(), '10.0', '>=') ? 'public function register(): void' . $eol . ' {' : 'public function register()' . $eol . ' {';