To make it easier to make commands in laravel and can already be used with .stub files.
- Paste file
CommandGenerator.phptoApp\Console\Commands. - Replace
CommandGeneratorclass toYourClass. - Rename the file accordingly.
- if your command interact with file .stub create file stub in
App\Console\stubs. - Edit property in file
CommandGenerator.php.
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'make:enum {name}'; // {name} don't change it/**
* The console command description.
*
* @var string
*/
protected $description = 'Create spatie enum';app/Console/stubs/create-enum.stub
/**
* the stub file path
*
* @var string
*/
protected $stubFile = 'create-enum';app/Console/stubs/create-enum.stub
/**
* the stub file path
*
* @var string
*/
protected $stubFile = 'create-enum';/**
* the class namespace
*
* @var string
*/
protected $namespace = 'App\\Enums';/**
* the path of generate file
*
* @var string
*/
protected $pathGenerateFile = 'app/Enums';