@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | $file = $this->getFile(); |
| 21 | 21 | |
| 22 | - $content = ! $this->fs->exists($file) ? '' : $this->fs->get($file); |
|
| 22 | + $content = !$this->fs->exists($file) ? '' : $this->fs->get($file); |
|
| 23 | 23 | |
| 24 | - $content .= $this->getTemplate(! $this->fs->exists($file) ? 'factory-create' : 'factory') |
|
| 24 | + $content .= $this->getTemplate(!$this->fs->exists($file) ? 'factory-create' : 'factory') |
|
| 25 | 25 | ->with([ |
| 26 | 26 | 'model' => $model, |
| 27 | 27 | 'factory_fields' => $this->getFieldsContent() |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | protected function getFile() |
| 35 | 35 | { |
| 36 | 36 | $file = $this->option('file'); |
| 37 | - if(! $file){ |
|
| 37 | + if (!$file) { |
|
| 38 | 38 | $file = './database/factories/ModelFactory.php'; |
| 39 | 39 | } |
| 40 | 40 | return $file; |
@@ -46,12 +46,12 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | $fields = $this->option('fields'); |
| 48 | 48 | |
| 49 | - if($fields){ |
|
| 50 | - if(! $this->option('parsed')){ |
|
| 49 | + if ($fields) { |
|
| 50 | + if (!$this->option('parsed')) { |
|
| 51 | 51 | $fields = $this->getArgumentParser('factory-fields')->parse($fields); |
| 52 | 52 | } |
| 53 | 53 | $template = $this->getTemplate('factory/field'); |
| 54 | - foreach($fields as $field){ |
|
| 54 | + foreach ($fields as $field) { |
|
| 55 | 55 | $content[] = $template->with($field)->get(); |
| 56 | 56 | } |
| 57 | 57 | $content = implode(PHP_EOL, $content); |
@@ -10,10 +10,10 @@ discard block |
||
| 10 | 10 | class BaseCommand extends Command { |
| 11 | 11 | |
| 12 | 12 | protected $fs; |
| 13 | - protected $templates; |
|
| 13 | + protected $templates; |
|
| 14 | 14 | |
| 15 | - public function __construct(Filesystem $fs) |
|
| 16 | - { |
|
| 15 | + public function __construct(Filesystem $fs) |
|
| 16 | + { |
|
| 17 | 17 | parent::__construct(); |
| 18 | 18 | |
| 19 | 19 | $this->fs = $fs; |
@@ -56,11 +56,11 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | protected function getNamespace($path = false) |
| 58 | 58 | { |
| 59 | - if (! $path) { |
|
| 60 | - $path = $this->option('path'); |
|
| 61 | - } |
|
| 59 | + if (! $path) { |
|
| 60 | + $path = $this->option('path'); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - return str_replace(' ', '\\', ucwords(trim(str_replace('/', ' ', $path)))); |
|
| 63 | + return str_replace(' ', '\\', ucwords(trim(str_replace('/', ' ', $path)))); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | return $this->templates->load($name); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - protected function getArgumentParser($name){ |
|
| 29 | + protected function getArgumentParser($name) { |
|
| 30 | 30 | $format = $this->argumentFormatLoader->load($name); |
| 31 | 31 | return new ArgumentParser($format); |
| 32 | 32 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | protected function getNamespace($path = false) |
| 58 | 58 | { |
| 59 | - if (! $path) { |
|
| 59 | + if (!$path) { |
|
| 60 | 60 | $path = $this->option('path'); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | |
| 4 | 4 | class MorphTableCommand extends BaseCommand { |
| 5 | 5 | |
| 6 | - protected $signature = 'wn:morph-table |
|
| 6 | + protected $signature = 'wn:morph-table |
|
| 7 | 7 | {model : Name of the persistant model or table} |
| 8 | 8 | {morphable : Name of the morphable identifier} |
| 9 | 9 | {--add= : specifies additional columns like timestamps, softDeletes, rememberToken and nullableTimestamps.} |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | {--force= : override the existing files} |
| 12 | 12 | '; |
| 13 | 13 | |
| 14 | - protected $description = 'Generates creation migration for a morphable pivot table'; |
|
| 14 | + protected $description = 'Generates creation migration for a morphable pivot table'; |
|
| 15 | 15 | |
| 16 | 16 | protected $fields; |
| 17 | 17 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | protected function keys() |
| 49 | 49 | { |
| 50 | 50 | // return implode(' ', $this->fields); |
| 51 | - return snake_case(str_singular($this->argument('model')))."_id"; |
|
| 51 | + return snake_case(str_singular($this->argument('model')))."_id"; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | } |
@@ -33,14 +33,14 @@ discard block |
||
| 33 | 33 | protected function parseFields() |
| 34 | 34 | { |
| 35 | 35 | $this->fields = array_map(function($arg, $app) { |
| 36 | - return snake_case(str_singular($this->argument($arg)))."_".$app; |
|
| 36 | + return snake_case(str_singular($this->argument($arg))) . "_" . $app; |
|
| 37 | 37 | }, ['model', 'morphable', 'morphable'], ['id', 'id', 'type']); |
| 38 | 38 | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | protected function schema() |
| 42 | 42 | { |
| 43 | - return implode(' ', array_map(function($field){ |
|
| 43 | + return implode(' ', array_map(function($field) { |
|
| 44 | 44 | return $field . ':' . (substr($field, -3) == '_id' ? 'integer:unsigned' : 'string.50') . ':index'; |
| 45 | 45 | }, $this->fields)); |
| 46 | 46 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | protected function keys() |
| 49 | 49 | { |
| 50 | 50 | // return implode(' ', $this->fields); |
| 51 | - return snake_case(str_singular($this->argument('model')))."_id"; |
|
| 51 | + return snake_case(str_singular($this->argument('model'))) . "_id"; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | } |