Skip to content

Commit

Permalink
Update InstallsSpladeStack.php
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalbaljet committed Mar 19, 2024
1 parent ab310b1 commit fa7de37
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/Console/InstallsSpladeStack.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Laravel\Jetstream\Console;

use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\ServiceProvider;
use ProtoneMedia\Splade\Commands\InstallsSpladeExceptionHandler;
use ProtoneMedia\Splade\Commands\InstallsSpladeRouteMiddleware;
use Symfony\Component\Console\Command\Command;
Expand All @@ -21,12 +22,7 @@ trait InstallsSpladeStack
*/
protected function installSpladeStack()
{
// Check Laravel version...
if (version_compare(app()->version(), '10.0', '<')) {
$this->error('While you can still use Splade with Laravel 9, new projects should use Laravel 10.');

return Command::FAILURE;
}
$legacyLaravelSkeleton = version_compare(app()->version(), '11.0', '<');

$this->replaceInFile('// Features::termsAndPrivacyPolicy(),', 'Features::termsAndPrivacyPolicy(),', config_path('jetstream.php'));
$this->replaceInFile('// Features::profilePhotos(),', 'Features::profilePhotos(),', config_path('jetstream.php'));
Expand Down Expand Up @@ -80,7 +76,9 @@ protected function installSpladeStack()
// Service Providers...
copy(__DIR__.'/../../stubs/app/Providers/JetstreamServiceProvider.php', app_path('Providers/JetstreamServiceProvider.php'));

$this->installServiceProviderAfter('FortifyServiceProvider', 'JetstreamServiceProvider');
$legacyLaravelSkeleton
? $this->installServiceProviderAfter('FortifyServiceProvider', 'JetstreamServiceProvider')
: ServiceProvider::addProviderToBootstrapFile('App\Providers\JetstreamServiceProvider');

// Models...
copy(__DIR__.'/../../stubs/app/Models/User.php', app_path('Models/User.php'));
Expand All @@ -107,8 +105,9 @@ protected function installSpladeStack()
->name('*.blade.php')
);

// Routes...
$this->replaceInFile('auth:api', 'auth:sanctum', base_path('routes/api.php'));
$legacyLaravelSkeleton
? $this->replaceInFile('auth:api', 'auth:sanctum', base_path('routes/api.php'))
: $this->call('install:api');

copy($spladeJetstreamStubsDir.'routes/web.php', base_path('routes/web.php'));

Expand Down

0 comments on commit fa7de37

Please sign in to comment.