In laravel 9.6 app I have a console command with several parameters :
class MakeCustomModelCommand extends Command
{
protected $signature = 'make:custom-model {name} {userRelation} {productRelation} {categoryRelation} {fillableFromDb} {castingFields}';
...
Which was created with command :
php artisan make:command MakeCustomModelCommand
But when I run the command with some of the params missing, I got error :
Not enough arguments (missing: "fillableFromDb, castingFields").
If there is a way to mark some parameters as nonrequired ?
>Solution :
yes you can create using ? operator,
protected $signature = 'make:custom-model {name?} {userRelation?} {productRelation?} {categoryRelation?} {fillableFromDb?} {castingFields?}';