Last active
April 14, 2016 20:21
-
-
Save MadMikeyB/81d09afeaad02dc1c1148899196b127f to your computer and use it in GitHub Desktop.
thinking out loud
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
<?php | |
namespace App\Console\Commands; | |
use Illuminate\Console\Command; | |
use Illuminate\Filesystem\Filesystem; | |
use Illuminate\Foundation\Console\ModelMakeCommand as ModelMakeCommand; | |
class MakeModelCommand extends ModelMakeCommand | |
{ | |
/** | |
* The name and signature of the console command. | |
* | |
* @var string | |
*/ | |
protected $signature = 'make:model {model : The name of the Model} {--directory= : The directory to store the model in. (optional)}'; | |
/** | |
* The console command description. | |
* | |
* @var string | |
*/ | |
protected $description = 'Generate an Eloquent Model in a given directory'; | |
/** | |
* The filesystem instance. | |
* | |
* @var Filesystem | |
*/ | |
protected $files; | |
/** | |
* Create a new command instance. | |
* | |
* @param Illuminate\Filesystem\Filesystem | |
* @return void | |
*/ | |
public function __construct(Filesystem $files) | |
{ | |
parent::__construct($files); | |
$this->files = $files; | |
} | |
/** | |
* Execute the console command. | |
* | |
* @return void | |
*/ | |
public function fire() | |
{ | |
if ($this->option('directory')) { | |
// do something with directory to make it mac / windows friendly | |
$model = $this->option('directory') .'/'. $this->argument('model') | |
// call make:model or just parent::fire(); | |
$this->call('make:model', ['model' => $model]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment