-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #128 from hamrahpay/patch-1
Create ModuleMakeControllerCommand.php
- Loading branch information
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
namespace Caffeinated\Modules\Console\Commands; | ||
|
||
use Caffeinated\Modules\Console\Handlers\ModuleMakeControllerHandler; | ||
use Illuminate\Console\Command; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
|
||
class ModuleMakeControllerCommand extends Command | ||
{ | ||
/** | ||
* @var string $name The console command name. | ||
*/ | ||
protected $name = 'module:make:controller'; | ||
|
||
/** | ||
* @var string $description The console command description. | ||
*/ | ||
protected $description = 'Create a new module controller class'; | ||
|
||
/** | ||
* @var \Caffeinated\Modules\Console\Handlers\ModuleMakeRequestHandler | ||
*/ | ||
protected $handler; | ||
|
||
/** | ||
* Create a new command instance. | ||
* | ||
* @param \Caffeinated\Modules\Console\Handlers\ModuleMakeRequestHandler $handler | ||
*/ | ||
public function __construct(ModuleMakeControllerHandler $handler) | ||
{ | ||
parent::__construct(); | ||
|
||
$this->handler = $handler; | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function fire() | ||
{ | ||
return $this->handler->fire($this, $this->argument('module'), $this->argument('name')); | ||
} | ||
|
||
/** | ||
* Get the console command arguments. | ||
* | ||
* @return array | ||
*/ | ||
protected function getArguments() | ||
{ | ||
return [ | ||
['module', InputArgument::REQUIRED, 'The slug of the module'], | ||
['name', InputArgument::REQUIRED, 'The name of the class'] | ||
]; | ||
} | ||
} |