From bb80a3b9e21f9197e115032ce3128ce3af747814 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Thu, 7 Mar 2024 17:44:40 +0000 Subject: [PATCH] [11.x] Allows to ignore`install:api` migration prompt (#50404) * Allows to ignore`install:api` migration prompt * Update ApiInstallCommand.php * Update ApiInstallCommand.php --------- Co-authored-by: Taylor Otwell --- src/Illuminate/Foundation/Console/ApiInstallCommand.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Illuminate/Foundation/Console/ApiInstallCommand.php b/src/Illuminate/Foundation/Console/ApiInstallCommand.php index 967c6fa16f56..7e2fceac6fab 100644 --- a/src/Illuminate/Foundation/Console/ApiInstallCommand.php +++ b/src/Illuminate/Foundation/Console/ApiInstallCommand.php @@ -21,7 +21,8 @@ class ApiInstallCommand extends Command protected $signature = 'install:api {--composer=global : Absolute path to the Composer binary which should be used to install packages} {--force : Overwrite any existing API routes file} - {--passport : Install Laravel Passport instead of Laravel Sanctum}'; + {--passport : Install Laravel Passport instead of Laravel Sanctum} + {--without-migration-prompt : Do not prompt to run pending migrations}'; /** * The console command description. @@ -69,8 +70,10 @@ public function handle() $this->components->info('API scaffolding installed. Please add the [Laravel\Passport\HasApiTokens] trait to your User model.'); } else { - if ($this->confirm('One new database migration has been published. Would you like to run all pending database migrations?', false)) { - $this->call('migrate'); + if (! $this->option('without-migration-prompt')) { + if ($this->confirm('One new database migration has been published. Would you like to run all pending database migrations?', true)) { + $this->call('migrate'); + } } $this->components->info('API scaffolding installed. Please add the [Laravel\Sanctum\HasApiTokens] trait to your User model.');