There is 2 way to group commands or call it from another command.
Variant 1:
Create new Console Command in routes/console.php
.
routes/console.php
Artisan::command('project:init', function () {
Artisan::call('migrate:refresh', []); // optional arguments
Artisan::call('db:seed');
Artisan::call('config:clear');
})->describe('Running commands');
Variant 2:
According to docs: https://laravel.com/docs/7.x/artisan#calling-commands-from-other-commands
Create new command using command line:
$ php artisan make:command ProjectInit --command project:init
This will create new file: App\Console\Commands\ProjectInit
In that ProjectInit
class's handle
method you can call another commands:
public function handle(){
$this->call('migrate:refresh', []); // optional arguments
$this->call('db:seed');
$this->call('config:clear');
}