@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $content = $this->fs->get($this->argument('file')); |
21 | 21 | $content = Yaml::parse($content); |
22 | 22 | |
23 | - foreach ($content as $model => $i){ |
|
23 | + foreach ($content as $model => $i) { |
|
24 | 24 | $i = $this->getResourceParams($model, $i); |
25 | 25 | |
26 | 26 | $this->call('wn:resource', [ |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | { |
65 | 65 | $i['name'] = snake_case($modelName); |
66 | 66 | |
67 | - foreach(['hasMany', 'hasOne', 'add', 'belongsTo', 'belongsToMany'] as $relation){ |
|
68 | - if(isset($i[$relation])){ |
|
67 | + foreach (['hasMany', 'hasOne', 'add', 'belongsTo', 'belongsToMany'] as $relation) { |
|
68 | + if (isset($i[$relation])) { |
|
69 | 69 | $i[$relation] = $this->convertArray($i[$relation], ' ', ','); |
70 | 70 | } else { |
71 | 71 | $i[$relation] = false; |
@@ -91,26 +91,26 @@ discard block |
||
91 | 91 | // } |
92 | 92 | // } |
93 | 93 | |
94 | - if($i['belongsToMany']){ |
|
94 | + if ($i['belongsToMany']) { |
|
95 | 95 | $relations = $this->getArgumentParser('relations')->parse($i['belongsToMany']); |
96 | - foreach ($relations as $relation){ |
|
96 | + foreach ($relations as $relation) { |
|
97 | 97 | $table = ''; |
98 | 98 | |
99 | - if(! $relation['model']){ |
|
99 | + if (!$relation['model']) { |
|
100 | 100 | $table = snake_case($relation['name']); |
101 | 101 | } else { |
102 | 102 | $names = array_reverse(explode("\\", $relation['model'])); |
103 | 103 | $table = snake_case($names[0]); |
104 | 104 | } |
105 | 105 | |
106 | - $tables = [ str_singular($table), $i['name'] ]; |
|
106 | + $tables = [str_singular($table), $i['name']]; |
|
107 | 107 | sort($tables); |
108 | 108 | $this->pivotTables[] = $tables; |
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | 112 | $fields = []; |
113 | - foreach($i['fields'] as $name => $value) { |
|
113 | + foreach ($i['fields'] as $name => $value) { |
|
114 | 114 | $value['name'] = $name; |
115 | 115 | $fields[] = $this->serializeField($value); |
116 | 116 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | $string = "{$name};{$schema};{$rules};{$tags}"; |
130 | 130 | |
131 | - if(isset($field['factory']) && !empty($field['factory'])){ |
|
131 | + if (isset($field['factory']) && !empty($field['factory'])) { |
|
132 | 132 | $string .= ';' . $field['factory']; |
133 | 133 | } |
134 | 134 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | |
138 | 138 | protected function convertArray($list, $old, $new) |
139 | 139 | { |
140 | - return implode($new, array_filter(explode($old, $list), function($item){ |
|
140 | + return implode($new, array_filter(explode($old, $list), function($item) { |
|
141 | 141 | return !empty($item); |
142 | 142 | })); |
143 | 143 | } |