Skip to content

Commit bb80a3b

Browse files
[11.x] Allows to ignoreinstall:api migration prompt (#50404)
* Allows to ignore`install:api` migration prompt * Update ApiInstallCommand.php * Update ApiInstallCommand.php --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent b8313c9 commit bb80a3b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Illuminate/Foundation/Console/ApiInstallCommand.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ class ApiInstallCommand extends Command
2121
protected $signature = 'install:api
2222
{--composer=global : Absolute path to the Composer binary which should be used to install packages}
2323
{--force : Overwrite any existing API routes file}
24-
{--passport : Install Laravel Passport instead of Laravel Sanctum}';
24+
{--passport : Install Laravel Passport instead of Laravel Sanctum}
25+
{--without-migration-prompt : Do not prompt to run pending migrations}';
2526

2627
/**
2728
* The console command description.
@@ -69,8 +70,10 @@ public function handle()
6970

7071
$this->components->info('API scaffolding installed. Please add the [Laravel\Passport\HasApiTokens] trait to your User model.');
7172
} else {
72-
if ($this->confirm('One new database migration has been published. Would you like to run all pending database migrations?', false)) {
73-
$this->call('migrate');
73+
if (! $this->option('without-migration-prompt')) {
74+
if ($this->confirm('One new database migration has been published. Would you like to run all pending database migrations?', true)) {
75+
$this->call('migrate');
76+
}
7477
}
7578

7679
$this->components->info('API scaffolding installed. Please add the [Laravel\Sanctum\HasApiTokens] trait to your User model.');

0 commit comments

Comments
 (0)