Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
Merge pull request #57 from Naoray/dev
Browse files Browse the repository at this point in the history
Fix model creation with flags
  • Loading branch information
Naoray authored Aug 28, 2019
2 parents f2c6e39 + b6fd6c3 commit 3bcfea7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 22 deletions.
14 changes: 8 additions & 6 deletions src/Commands/Database/MigrationMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ class MigrationMakeCommand extends MakeMigration
/**
* Create a new migration install command instance.
*
* @param Illuminate\Filesystem\Filesystem $creator
* @param \Illuminate\Database\Migrations\MigrationCreator $creator
* @param \Illuminate\Support\Composer $composer
* @return void
* @param Illuminate\Filesystem\Filesystem $creator
* @param \Illuminate\Database\Migrations\MigrationCreator $creator
* @param \Illuminate\Support\Composer $composer
*/
public function __construct(Filesystem $files, MigrationCreator $creator, Composer $composer)
{
Expand Down Expand Up @@ -66,7 +65,8 @@ protected function getMigrationPath()
/**
* Build the directory for the class if necessary.
*
* @param string $path
* @param string $path
*
* @return string
*/
protected function makeDirectory($path)
Expand All @@ -92,7 +92,9 @@ protected function additionalOptions()

['path', null, InputOption::VALUE_REQUIRED, 'The location where the migration file should be created'],

['realpath', null, InputOption::VALUE_REQUIRED, 'Indicate any provided migration file paths are pre - resolved absolute paths'],
['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre - resolved absolute paths'],

['fullpath', null, InputOption::VALUE_NONE, 'Output the full path of the migration'],
];
}
}
18 changes: 6 additions & 12 deletions src/Commands/Foundation/ModelMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ protected function resolveDirectory()

/**
* Create a model factory for the model.
*
* @return void
*/
protected function createFactory()
{
Expand All @@ -39,15 +37,13 @@ protected function createFactory()
$this->call('package:factory', [
'name' => "{$factory}Factory",
'--model' => $this->argument('name'),
'--namespace' => $this->rootNamespace(),
'--dir' => $this->basePath(),
'--namespace' => $this->getNamespaceInput(),
'--dir' => $this->getDirInput(),
]);
}

/**
* Create a migration file for the model.
*
* @return void
*/
protected function createMigration()
{
Expand All @@ -56,15 +52,13 @@ protected function createMigration()
$this->call('package:migration', [
'name' => "create_{$table}_table",
'--create' => $table,
'--namespace' => $this->rootNamespace(),
'--dir' => $this->basePath(),
'--namespace' => $this->getNamespaceInput(),
'--dir' => $this->getDirInput(),
]);
}

/**
* Create a controller for the model.
*
* @return void
*/
protected function createController()
{
Expand All @@ -75,8 +69,8 @@ protected function createController()
$this->call('package:controller', [
'name' => "{$controller}Controller",
'--model' => $this->option('resource') ? $modelName : null,
'--namespace' => $this->rootNamespace(),
'--dir' => $this->basePath(),
'--namespace' => $this->getNamespaceInput(),
'--dir' => $this->getDirInput(),
]);
}
}
8 changes: 4 additions & 4 deletions src/Commands/Routing/ControllerMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ class ControllerMakeCommand extends MakeController
*/
protected function resolveDirectory()
{
// Illuminate\Routing\Controller DummyRootNamespaceHttp\Controllers\Controller;

return $this->getDirInput().'src';
}

Expand Down Expand Up @@ -84,7 +82,8 @@ protected function buildParentReplacements()
/**
* Build the model replacement values.
*
* @param array $replace
* @param array $replace
*
* @return array
*/
protected function buildModelReplacements(array $replace)
Expand All @@ -111,7 +110,8 @@ protected function buildModelReplacements(array $replace)
/**
* Get the fully-qualified model class name.
*
* @param string $model
* @param string $model
*
* @return string
*/
protected function parseModel($model)
Expand Down

0 comments on commit 3bcfea7

Please sign in to comment.