| @@ 9-37 (lines=29) @@ | ||
| 6 | use Yarak\Console\CommandCreator; |
|
| 7 | use Symfony\Component\Console\Input\InputArgument; |
|
| 8 | ||
| 9 | class MakeCommand extends YarakCommand |
|
| 10 | { |
|
| 11 | /** |
|
| 12 | * Configure the command. |
|
| 13 | */ |
|
| 14 | protected function configure() |
|
| 15 | { |
|
| 16 | $this->setName('make:command') |
|
| 17 | ->setDescription('Create a new command file.') |
|
| 18 | ->setHelp('This command will generate a new command file.') |
|
| 19 | ->addArgument( |
|
| 20 | 'name', |
|
| 21 | InputArgument::REQUIRED, |
|
| 22 | 'The name of your command file.'); |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * Handle the command. |
|
| 27 | */ |
|
| 28 | protected function handle() |
|
| 29 | { |
|
| 30 | $creator = new CommandCreator( |
|
| 31 | Config::getInstance($this->configArray), |
|
| 32 | $this->getOutput() |
|
| 33 | ); |
|
| 34 | ||
| 35 | $creator->create($this->argument('name')); |
|
| 36 | } |
|
| 37 | } |
|
| 38 | ||
| @@ 9-37 (lines=29) @@ | ||
| 6 | use Yarak\DB\Seeders\SeederCreator; |
|
| 7 | use Symfony\Component\Console\Input\InputArgument; |
|
| 8 | ||
| 9 | class MakeSeeder extends YarakCommand |
|
| 10 | { |
|
| 11 | /** |
|
| 12 | * Configure the command. |
|
| 13 | */ |
|
| 14 | protected function configure() |
|
| 15 | { |
|
| 16 | $this->setName('make:seeder') |
|
| 17 | ->setDescription('Create a new seeder file.') |
|
| 18 | ->setHelp('This command will generate a new seeder file.') |
|
| 19 | ->addArgument( |
|
| 20 | 'name', |
|
| 21 | InputArgument::REQUIRED, |
|
| 22 | 'The name of your seeder file.'); |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * Handle the command. |
|
| 27 | */ |
|
| 28 | protected function handle() |
|
| 29 | { |
|
| 30 | $creator = new SeederCreator( |
|
| 31 | Config::getInstance($this->configArray), |
|
| 32 | $this->getOutput() |
|
| 33 | ); |
|
| 34 | ||
| 35 | $creator->create($this->argument('name')); |
|
| 36 | } |
|
| 37 | } |
|
| 38 | ||