@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | ]); |
63 | 63 | |
64 | 64 | // generating REST actions trait if doesn't exist |
65 | - if(! $this->fs->exists('./app/Http/Controllers/RESTActions.php')){ |
|
65 | + if (!$this->fs->exists('./app/Http/Controllers/RESTActions.php')) { |
|
66 | 66 | $this->call('wn:controller:rest-actions'); |
67 | 67 | } |
68 | 68 | // generating the controller and routes |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | protected function parseFields() |
95 | 95 | { |
96 | 96 | $fields = $this->argument('fields'); |
97 | - if($this->option('parsed')){ |
|
97 | + if ($this->option('parsed')) { |
|
98 | 98 | $this->fields = $fields; |
99 | 99 | } else { |
100 | - if(! $fields){ |
|
100 | + if (!$fields) { |
|
101 | 101 | $this->fields = []; |
102 | 102 | } else { |
103 | 103 | $this->fields = $this->getArgumentParser('fields') |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | protected function fieldsHavingTag($tag) |
123 | 123 | { |
124 | - return array_map(function($field){ |
|
124 | + return array_map(function($field) { |
|
125 | 125 | return $field['name']; |
126 | 126 | }, array_filter($this->fields, function($field) use($tag){ |
127 | 127 | return in_array($tag, $field['tags']); |
@@ -130,19 +130,19 @@ discard block |
||
130 | 130 | |
131 | 131 | protected function rules() |
132 | 132 | { |
133 | - return array_map(function($field){ |
|
133 | + return array_map(function($field) { |
|
134 | 134 | return [ |
135 | 135 | 'name' => $field['name'], |
136 | 136 | 'rule' => $field['rules'] |
137 | 137 | ]; |
138 | - }, array_filter($this->fields, function($field){ |
|
138 | + }, array_filter($this->fields, function($field) { |
|
139 | 139 | return !empty($field['rules']); |
140 | 140 | })); |
141 | 141 | } |
142 | 142 | |
143 | 143 | protected function schema() |
144 | 144 | { |
145 | - return array_map(function($field){ |
|
145 | + return array_map(function($field) { |
|
146 | 146 | return array_merge([[ |
147 | 147 | 'name' => $field['name'], |
148 | 148 | 'args' => [] |
@@ -153,14 +153,14 @@ discard block |
||
153 | 153 | protected function foreignKeys() |
154 | 154 | { |
155 | 155 | $belongsTo = $this->option('belongs-to'); |
156 | - if(! $belongsTo) { |
|
156 | + if (!$belongsTo) { |
|
157 | 157 | return []; |
158 | 158 | } |
159 | 159 | $relations = $this->getArgumentParser('relations')->parse($belongsTo); |
160 | - return array_map(function($relation){ |
|
160 | + return array_map(function($relation) { |
|
161 | 161 | $name = $relation['model'] ? $relation['model'] : $relation['name']; |
162 | 162 | $index = strrpos($name, "\\"); |
163 | - if($index) { |
|
163 | + if ($index) { |
|
164 | 164 | $name = substr($name, $index + 1); |
165 | 165 | } |
166 | 166 | return Str::snake(str_singular($name)) . '_id'; |
@@ -181,12 +181,12 @@ discard block |
||
181 | 181 | |
182 | 182 | protected function factoryFields() |
183 | 183 | { |
184 | - return array_map(function($field){ |
|
184 | + return array_map(function($field) { |
|
185 | 185 | return [ |
186 | 186 | 'name' => $field['name'], |
187 | 187 | 'type' => $field['factory'] |
188 | 188 | ]; |
189 | - }, array_filter($this->fields, function($field){ |
|
189 | + }, array_filter($this->fields, function($field) { |
|
190 | 190 | return isset($field['factory']) && $field['factory']; |
191 | 191 | })); |
192 | 192 | } |