@@ -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 | } |