@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $vue, |
69 | 69 | 'Form', |
70 | 70 | 'editable', |
71 | - function (Field $f) { |
|
71 | + function(Field $f) { |
|
72 | 72 | if (!$f->getExtradata('modelFillable')) { |
73 | 73 | return false; |
74 | 74 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | 'required' => true |
156 | 156 | ] |
157 | 157 | ]; |
158 | - $cardFieldNames = array_map(function (Field $f) { |
|
158 | + $cardFieldNames = array_map(function(Field $f) { |
|
159 | 159 | return $f->getName(); |
160 | 160 | }, $this->generator->getCardFields()); |
161 | 161 | $vueCode->setExtraProps($extraprops); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | ] |
184 | 184 | ]; |
185 | 185 | $vueCode->setExtraProps($extraprops); |
186 | - $cardFieldNames = array_map(function (Field $f) { |
|
186 | + $cardFieldNames = array_map(function(Field $f) { |
|
187 | 187 | return $f->getName(); |
188 | 188 | }, $this->generator->getCardFields()); |
189 | 189 | foreach ($this->generator->getCardFields() as $f) { |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | public function vueTableItem(FrameworkVue $vue): void |
201 | 201 | { |
202 | 202 | $vueCode = $vue->getVueCode(); |
203 | - $tableFieldNames = array_map(function (Field $f) { |
|
203 | + $tableFieldNames = array_map(function(Field $f) { |
|
204 | 204 | return $f->getName(); |
205 | 205 | }, $this->generator->getTableFields()); |
206 | 206 | $extraprops = [ |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | |
243 | 243 | if ($mode == 'editable') { |
244 | 244 | $vue->setEditableTemplate( |
245 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
245 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
246 | 246 | return $this->generator->templateCallback($stub, $vue, $data, $m); |
247 | 247 | } |
248 | 248 | ); |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | ); |
257 | 257 | } else { |
258 | 258 | $vue->setViewableTemplate( |
259 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
259 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
260 | 260 | return $this->generator->templateCallback($stub, $vue, $data, $m); |
261 | 261 | } |
262 | 262 | ); |
@@ -288,14 +288,14 @@ discard block |
||
288 | 288 | ]; |
289 | 289 | |
290 | 290 | $import = array_map( |
291 | - function ($i) use ($name) { |
|
291 | + function($i) use ($name) { |
|
292 | 292 | return "import {$name}$i from './{$name}$i.vue';"; |
293 | 293 | }, |
294 | 294 | $items |
295 | 295 | ); |
296 | 296 | |
297 | 297 | $export = array_map( |
298 | - function ($i) use ($name) { |
|
298 | + function($i) use ($name) { |
|
299 | 299 | return " {$name}$i,\n"; |
300 | 300 | }, |
301 | 301 | $items |
@@ -137,12 +137,12 @@ discard block |
||
137 | 137 | $hasVue = $this->composer->getByName('Vue'); |
138 | 138 | |
139 | 139 | $this->cardFields = $this->model->filterField( |
140 | - function (Field $field) { |
|
140 | + function(Field $field) { |
|
141 | 141 | return $field->getRenderable('card', false); |
142 | 142 | } |
143 | 143 | ); |
144 | 144 | $this->tableFields = $this->model->filterField( |
145 | - function (Field $field) { |
|
145 | + function(Field $field) { |
|
146 | 146 | return $field->getRenderable('table', false); |
147 | 147 | } |
148 | 148 | ); |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | Button::TYPE => 'a', |
154 | 154 | Button::ATTRIBUTES => [ |
155 | 155 | 'href' => "/{$this->routeBase}/edit" |
156 | - ] + ($hasVue ? [ "v-if" => 'can.create' ]: []), |
|
156 | + ] + ($hasVue ? ["v-if" => 'can.create'] : []), |
|
157 | 157 | ] |
158 | 158 | )->setContent( |
159 | 159 | '<i class="fa fa-plus"></i> Add new', |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | Button::TYPE => ($hasVue ? 'router-link' : 'a'), |
168 | 168 | Button::ATTRIBUTES => [ |
169 | 169 | ':to' => "'/{$this->lowerName}/' + model.{$this->keyAttribute} + '/edit'" |
170 | - ] + ($hasVue ? [ "v-if" => 'can.edit' ]: []), |
|
170 | + ] + ($hasVue ? ["v-if" => 'can.edit'] : []), |
|
171 | 171 | ] |
172 | 172 | )->setContent( |
173 | 173 | '<i class="fa fa-pencil"></i> Edit', |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | Button::ATTRIBUTES => [ |
184 | 184 | 'href' => '#', |
185 | 185 | '@click.prevent' => 'remove' |
186 | - ] + ($hasVue ? [ "v-if" => 'can.delete' ]: []), |
|
186 | + ] + ($hasVue ? ["v-if" => 'can.delete'] : []), |
|
187 | 187 | ] |
188 | 188 | )->setContent( |
189 | 189 | '<i class="fa fa-trash"></i> Delete', |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | 'Table', |
199 | 199 | [ |
200 | 200 | Table::ROW_NAMES => array_map( |
201 | - function (Field $field) { |
|
201 | + function(Field $field) { |
|
202 | 202 | return $field->getRenderable(Renderable::LABEL, $field->getName()); |
203 | 203 | }, |
204 | 204 | $this->tableFields |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | true |
217 | 217 | ); |
218 | 218 | $titleFields = $this->model->filterField( |
219 | - function (Field $field) { |
|
219 | + function(Field $field) { |
|
220 | 220 | return $field->getRenderable('title', false); |
221 | 221 | } |
222 | 222 | ); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | 'keyAttribute' => $this->keyAttribute, |
243 | 243 | 'spinner' => $spinner, |
244 | 244 | 'tablelist' => $table->getRenderHTML(), |
245 | - 'tableItemFields' => array_keys(array_map(function (Field $f) { |
|
245 | + 'tableItemFields' => array_keys(array_map(function(Field $f) { |
|
246 | 246 | return $f->getName(); |
247 | 247 | }, $this->tableFields)), |
248 | 248 | 'typeTitle' => $this->studlyName, |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | * card |
321 | 321 | */ |
322 | 322 | $cardFieldNames = array_map( |
323 | - function (Field $field) { |
|
323 | + function(Field $field) { |
|
324 | 324 | return $field->getName(); |
325 | 325 | }, |
326 | 326 | $this->cardFields |
@@ -333,8 +333,8 @@ discard block |
||
333 | 333 | $filtersQuery = ', ' . join( |
334 | 334 | ', ', |
335 | 335 | array_map( |
336 | - function ($item) { |
|
337 | - return '$' . $item['name'] . ': ' . $item['type'] . ($item['required'] ? '!' : ''); |
|
336 | + function($item) { |
|
337 | + return '$' . $item['name'] . ': ' . $item['type'] . ($item['required'] ? '!' : ''); |
|
338 | 338 | }, |
339 | 339 | $filters |
340 | 340 | ) |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | $filtersParams = ', ' . join( |
343 | 343 | ', ', |
344 | 344 | array_map( |
345 | - function ($item) { |
|
345 | + function($item) { |
|
346 | 346 | return $item['name'] . ': $' . $item['name']; |
347 | 347 | }, |
348 | 348 | $filters |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | * table |
382 | 382 | */ |
383 | 383 | $tableFieldNames = array_map( |
384 | - function (Field $field) { |
|
384 | + function(Field $field) { |
|
385 | 385 | return $field->getName(); |
386 | 386 | }, |
387 | 387 | $this->tableFields |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | * item |
418 | 418 | */ |
419 | 419 | $graphqlQuery = $this->model->mapFields( |
420 | - function (Field $f) { |
|
420 | + function(Field $f) { |
|
421 | 421 | return \Modelarium\Frontend\Util::fieldShow($f) ? $f->toGraphqlQuery() : null; |
422 | 422 | } |
423 | 423 | ); |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | $writtenFiles = $this->writeFiles( |
157 | 157 | $collection, |
158 | 158 | $basepath, |
159 | - function (GeneratedItem $i) use ($match) { |
|
160 | - if ((bool)$this->option('overwrite') === true) { |
|
159 | + function(GeneratedItem $i) use ($match) { |
|
160 | + if ((bool) $this->option('overwrite') === true) { |
|
161 | 161 | return true; |
162 | 162 | } |
163 | - if ((bool)$this->option('overwrite-graphql') === true) { |
|
163 | + if ((bool) $this->option('overwrite-graphql') === true) { |
|
164 | 164 | if ( |
165 | 165 | StringUtil::endsWith($i->filename, '.graphql') |
166 | 166 | ) { |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | // this runs all prettier commands in parallel. |
190 | 190 | $run = array_reduce( |
191 | 191 | $writtenFiles, |
192 | - function ($carry, $f) use ($command) { |
|
192 | + function($carry, $f) use ($command) { |
|
193 | 193 | return $carry . '(' . $command . $f . ') & '; |
194 | 194 | } |
195 | 195 | ); |
@@ -23,7 +23,7 @@ |
||
23 | 23 | throw new Exception("You must provide at least one field to a full text index"); |
24 | 24 | } |
25 | 25 | $generator->postCreateCode[] = "DB::statement('ALTER TABLE " . |
26 | - $generator->getTableName() . |
|
26 | + $generator->getTableName() . |
|
27 | 27 | " ADD FULLTEXT fulltext_index (\"" . |
28 | 28 | implode('", "', $indexFields) . |
29 | 29 | "\")');"; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | return new GeneratedCollection( |
34 | - [ new GeneratedItem( |
|
34 | + [new GeneratedItem( |
|
35 | 35 | GeneratedItem::TYPE_FACTORY, |
36 | 36 | $this->generateString(), |
37 | 37 | $this->getGenerateFilename() |
@@ -50,6 +50,6 @@ discard block |
||
50 | 50 | |
51 | 51 | public function getGenerateFilename(): string |
52 | 52 | { |
53 | - return $this->getBasePath('database/factories/'. $this->studlyName . 'Factory.php'); |
|
53 | + return $this->getBasePath('database/factories/' . $this->studlyName . 'Factory.php'); |
|
54 | 54 | } |
55 | 55 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | 'implements' => implode( |
23 | 23 | ', ', |
24 | 24 | array_map( |
25 | - function ($i) { |
|
25 | + function($i) { |
|
26 | 26 | return Str::studly($i) . 'DirectiveInterface'; |
27 | 27 | }, |
28 | 28 | $processors |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | // Script example.php |
63 | -$longopts = array( |
|
63 | +$longopts = array( |
|
64 | 64 | "name:", |
65 | 65 | "processors:" |
66 | 66 | ); |
@@ -60,18 +60,18 @@ |
||
60 | 60 | $targetSingle = mb_strtolower($generator->getInflector()->singularize($datatype->getTarget())); |
61 | 61 | $targetPlural = $datatype->getTargetTable(); |
62 | 62 | switch ($datatype->getRelationship()) { |
63 | - case RelationshipFactory::RELATIONSHIP_ONE_TO_ONE: |
|
64 | - case RelationshipFactory::MORPH_ONE_TO_ONE: |
|
65 | - $target = $targetSingle; |
|
66 | - break; |
|
67 | - case RelationshipFactory::RELATIONSHIP_ONE_TO_MANY: |
|
68 | - case RelationshipFactory::MORPH_ONE_TO_MANY: |
|
69 | - $target = $datatype->getIsInverse() ? $targetSingle : $targetPlural; |
|
70 | - break; |
|
71 | - case RelationshipFactory::RELATIONSHIP_MANY_TO_MANY: |
|
72 | - case RelationshipFactory::MORPH_MANY_TO_MANY: |
|
73 | - $target = $targetPlural; |
|
74 | - break; |
|
63 | + case RelationshipFactory::RELATIONSHIP_ONE_TO_ONE: |
|
64 | + case RelationshipFactory::MORPH_ONE_TO_ONE: |
|
65 | + $target = $targetSingle; |
|
66 | + break; |
|
67 | + case RelationshipFactory::RELATIONSHIP_ONE_TO_MANY: |
|
68 | + case RelationshipFactory::MORPH_ONE_TO_MANY: |
|
69 | + $target = $datatype->getIsInverse() ? $targetSingle : $targetPlural; |
|
70 | + break; |
|
71 | + case RelationshipFactory::RELATIONSHIP_MANY_TO_MANY: |
|
72 | + case RelationshipFactory::MORPH_MANY_TO_MANY: |
|
73 | + $target = $targetPlural; |
|
74 | + break; |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | $generator->with[] = $target; |