@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | public function handle() |
19 | 19 | { |
20 | 20 | $path = ''; |
21 | - if (! is_null($this->option('path'))) { |
|
21 | + if (!is_null($this->option('path'))) { |
|
22 | 22 | $path = $this->option('path'); |
23 | 23 | } |
24 | 24 | |
25 | 25 | $content = $this->fs->get($path . $this->argument('file')); |
26 | 26 | $content = Yaml::parse($content); |
27 | 27 | |
28 | - foreach ($content as $model => $i){ |
|
28 | + foreach ($content as $model => $i) { |
|
29 | 29 | $i = $this->getResourceParams($model, $i); |
30 | 30 | |
31 | 31 | $this->call('wn:resource', [ |
@@ -69,34 +69,34 @@ discard block |
||
69 | 69 | { |
70 | 70 | $i['name'] = snake_case($modelName); |
71 | 71 | |
72 | - foreach(['hasMany', 'hasOne', 'add', 'belongsTo', 'belongsToMany'] as $relation){ |
|
73 | - if(isset($i[$relation])){ |
|
72 | + foreach (['hasMany', 'hasOne', 'add', 'belongsTo', 'belongsToMany'] as $relation) { |
|
73 | + if (isset($i[$relation])) { |
|
74 | 74 | $i[$relation] = $this->convertArray($i[$relation], ' ', ','); |
75 | 75 | } else { |
76 | 76 | $i[$relation] = false; |
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
80 | - if($i['belongsToMany']){ |
|
80 | + if ($i['belongsToMany']) { |
|
81 | 81 | $relations = $this->getArgumentParser('relations')->parse($i['belongsToMany']); |
82 | - foreach ($relations as $relation){ |
|
82 | + foreach ($relations as $relation) { |
|
83 | 83 | $table = ''; |
84 | 84 | |
85 | - if(! $relation['model']){ |
|
85 | + if (!$relation['model']) { |
|
86 | 86 | $table = snake_case($relation['name']); |
87 | 87 | } else { |
88 | 88 | $names = array_reverse(explode("\\", $relation['model'])); |
89 | 89 | $table = snake_case($names[0]); |
90 | 90 | } |
91 | 91 | |
92 | - $tables = [ str_singular($table), $i['name'] ]; |
|
92 | + $tables = [str_singular($table), $i['name']]; |
|
93 | 93 | sort($tables); |
94 | 94 | $this->pivotTables[] = $tables; |
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
98 | 98 | $fields = []; |
99 | - foreach($i['fields'] as $name => $value) { |
|
99 | + foreach ($i['fields'] as $name => $value) { |
|
100 | 100 | $value['name'] = $name; |
101 | 101 | $fields[] = $this->serializeField($value); |
102 | 102 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | $string = "{$name};{$schema};{$rules};{$tags}"; |
116 | 116 | |
117 | - if(isset($field['factory']) && !empty($field['factory'])){ |
|
117 | + if (isset($field['factory']) && !empty($field['factory'])) { |
|
118 | 118 | $string .= ';' . $field['factory']; |
119 | 119 | } |
120 | 120 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | protected function convertArray($list, $old, $new) |
125 | 125 | { |
126 | - return implode($new, array_filter(explode($old, $list), function($item){ |
|
126 | + return implode($new, array_filter(explode($old, $list), function($item) { |
|
127 | 127 | return !empty($item); |
128 | 128 | })); |
129 | 129 | } |