Use $this->call() for Artisan commands

This commit is contained in:
Dan Harrin
2021-03-23 10:40:53 +00:00
parent f06b3ded12
commit 43c47252d3
+8 -19
View File
@@ -15,28 +15,17 @@ class UpgradeCommand extends Command
public function handle()
{
$commands = [
'composer update',
'php artisan migrate',
'php artisan livewire:discover',
'php artisan route:clear',
'php artisan view:clear',
];
system('composer update');
$bar = $this->output->createProgressBar(count($commands));
$bar->start();
foreach ($commands as $command) {
$this->newLine(2);
system($command);
$bar->advance();
foreach ([
'migrate',
'livewire:discover',
'route:clear',
'view:clear',
] as $command) {
$this->call($command);
}
$bar->finish();
$this->newLine(2);
$this->info('Successfully upgraded!');
}
}