for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace BiiiiiigMonster\LaravelEnum\Commands;
use Illuminate\Console\GeneratorCommand;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputOption;
#[AsCommand(name: 'make:enum')]
class EnumMakeCommand extends GeneratorCommand
{
/**
* The console command name.
*
* @var string
*/
protected $name = 'make:enum';
* The console command description.
protected $description = 'Create a new custom enum class';
* The type of class being generated.
protected $type = 'Enum';
* Get the stub file for the generator.
* @return string
protected function getStub()
$relativePath = '/stubs/enum.stub';
return file_exists($customPath = $this->laravel->basePath(trim($relativePath, '/')))
? $customPath
: __DIR__.$relativePath;
}
* Get the default namespace for the class.
* @param string $rootNamespace
protected function getDefaultNamespace($rootNamespace)
return $rootNamespace . '\Enums';
* Get the console command arguments.
* @return array
protected function getOptions()
return [
['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the enum already exists'],
];