Skip to content

Commit

Permalink
Fix for L10 installation (#318)
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalbaljet authored Feb 15, 2023
1 parent c381332 commit 80c920e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/Commands/InstallsSpladeExceptionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ protected function installExceptionHandler()

$exceptionHandler = file_get_contents(app_path('Exceptions/Handler.php'));

$search = 'public function register()' . $eol . ' {';
$search = version_compare(app()->version(), '10.0', '>=')
? 'public function register(): void' . $eol . ' {'
: 'public function register()' . $eol . ' {';

$registerMethodAfter = Str::after($exceptionHandler, $search);

Expand Down
8 changes: 6 additions & 2 deletions src/Commands/InstallsSpladeRouteMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -29,7 +33,7 @@ protected function installRouteMiddleware()
app_path('Http/Kernel.php'),
str_replace(
$routeMiddlewareAfter,
' ' . $routeMiddleware . ',' . SpladeInstallCommand::eol() . $routeMiddlewareAfter,
' ' . $routeMiddleware . ',' . $eol . $routeMiddlewareAfter,
$httpKernel
)
);
Expand Down

0 comments on commit 80c920e

Please sign in to comment.