@@ -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; |
@@ -233,7 +233,7 @@ |
||
233 | 233 | $this->fModel->appendExtradata( |
234 | 234 | new Extradata( |
235 | 235 | 'hasCan', |
236 | - [ new ExtradataParameter('value', true) ] |
|
236 | + [new ExtradataParameter('value', true)] |
|
237 | 237 | ) |
238 | 238 | ); |
239 | 239 | return; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $vue, |
70 | 70 | 'Form', |
71 | 71 | 'editable', |
72 | - function (Field $f) { |
|
72 | + function(Field $f) { |
|
73 | 73 | if (!$f->getExtradata('modelFillable')) { |
74 | 74 | return false; |
75 | 75 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | Button::TYPE => ($hasVuex ? 'router-link' : 'a'), |
94 | 94 | Button::ATTRIBUTES => [ |
95 | 95 | $targetAttribute => "/{$routeBase}/edit", |
96 | - ] + ($hasCan ? [ "v-if" => 'can.create' ]: []), |
|
96 | + ] + ($hasCan ? ["v-if" => 'can.create'] : []), |
|
97 | 97 | ] |
98 | 98 | )->setContent( |
99 | 99 | '<i class="fa fa-plus"></i> Add new', |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | Button::TYPE => ($hasVuex ? 'router-link' : 'a'), |
108 | 108 | Button::ATTRIBUTES => [ |
109 | 109 | $targetAttribute => "'/{$routeBase}/' + model.{$keyAttribute} + '/edit'", |
110 | - ] + ($hasCan ? [ "v-if" => 'can.edit' ]: []), |
|
110 | + ] + ($hasCan ? ["v-if" => 'can.edit'] : []), |
|
111 | 111 | ] |
112 | 112 | )->setContent( |
113 | 113 | '<i class="fa fa-pencil"></i> Edit', |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | Button::ATTRIBUTES => [ |
124 | 124 | 'href' => '#', |
125 | 125 | '@click.prevent' => 'remove', |
126 | - ] + ($hasCan ? [ "v-if" => 'can.delete' ]: []), |
|
126 | + ] + ($hasCan ? ["v-if" => 'can.delete'] : []), |
|
127 | 127 | ] |
128 | 128 | )->setContent( |
129 | 129 | '<i class="fa fa-trash"></i> Delete', |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $this->generator->templateParameters['buttonDelete'] = $buttonDelete; |
137 | 137 | |
138 | 138 | $this->generator->templateParameters['tableItemFields'] = |
139 | - array_values(array_map(function (Field $f) { |
|
139 | + array_values(array_map(function(Field $f) { |
|
140 | 140 | if ($f->getDatatype()->getBasetype() === 'relationship') { |
141 | 141 | $name = $f->getName(); |
142 | 142 | return "<{$name}-link v-bind=\"{$name}\"></{$name}-link>"; |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | 'required' => true |
222 | 222 | ] |
223 | 223 | ]; |
224 | - $cardFieldNames = array_map(function (Field $f) { |
|
224 | + $cardFieldNames = array_map(function(Field $f) { |
|
225 | 225 | return $f->getName(); |
226 | 226 | }, $this->generator->getCardFields()); |
227 | 227 | $vueCode->setExtraProps($extraprops); |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | ] |
250 | 250 | ]; |
251 | 251 | $vueCode->setExtraProps($extraprops); |
252 | - $cardFieldNames = array_map(function (Field $f) { |
|
252 | + $cardFieldNames = array_map(function(Field $f) { |
|
253 | 253 | return $f->getName(); |
254 | 254 | }, $this->generator->getCardFields()); |
255 | 255 | foreach ($this->generator->getCardFields() as $f) { |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | public function vueTableItem(FrameworkVue $vue): void |
275 | 275 | { |
276 | 276 | $vueCode = $vue->getVueCode(); |
277 | - $tableFieldNames = array_map(function (Field $f) { |
|
277 | + $tableFieldNames = array_map(function(Field $f) { |
|
278 | 278 | return $f->getName(); |
279 | 279 | }, $this->generator->getTableFields()); |
280 | 280 | $extraprops = [ |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | |
317 | 317 | if ($mode == 'editable') { |
318 | 318 | $vue->setEditableTemplate( |
319 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
319 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
320 | 320 | return $this->generator->templateCallback($stub, $vue, $data, $m); |
321 | 321 | } |
322 | 322 | ); |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | ); |
331 | 331 | } else { |
332 | 332 | $vue->setViewableTemplate( |
333 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
333 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
334 | 334 | return $this->generator->templateCallback($stub, $vue, $data, $m); |
335 | 335 | } |
336 | 336 | ); |
@@ -362,14 +362,14 @@ discard block |
||
362 | 362 | ]; |
363 | 363 | |
364 | 364 | $import = array_map( |
365 | - function ($i) use ($name) { |
|
365 | + function($i) use ($name) { |
|
366 | 366 | return "import {$name}$i from './{$name}$i.vue';"; |
367 | 367 | }, |
368 | 368 | $items |
369 | 369 | ); |
370 | 370 | |
371 | 371 | $export = array_map( |
372 | - function ($i) use ($name) { |
|
372 | + function($i) use ($name) { |
|
373 | 373 | return " {$name}$i,\n"; |
374 | 374 | }, |
375 | 375 | $items |
@@ -139,17 +139,17 @@ discard block |
||
139 | 139 | public function buildTemplateParameters(): void |
140 | 140 | { |
141 | 141 | $this->titleFields = $this->fModel->filterField( |
142 | - function (Field $field) { |
|
142 | + function(Field $field) { |
|
143 | 143 | return $field->getRenderable('title', false); |
144 | 144 | } |
145 | 145 | ); |
146 | 146 | $this->cardFields = $this->fModel->filterField( |
147 | - function (Field $field) { |
|
147 | + function(Field $field) { |
|
148 | 148 | return $field->getRenderable('card', false); |
149 | 149 | } |
150 | 150 | ); |
151 | 151 | $this->tableFields = $this->fModel->filterField( |
152 | - function (Field $field) { |
|
152 | + function(Field $field) { |
|
153 | 153 | return $field->getRenderable('table', false); |
154 | 154 | } |
155 | 155 | ); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | 'Table', |
206 | 206 | [ |
207 | 207 | Table::ROW_NAMES => array_map( |
208 | - function (Field $field) { |
|
208 | + function(Field $field) { |
|
209 | 209 | return $field->getRenderable(Renderable::LABEL, $field->getName()); |
210 | 210 | }, |
211 | 211 | $this->tableFields |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | true |
224 | 224 | ); |
225 | 225 | $titleFields = $this->fModel->filterField( |
226 | - function (Field $field) { |
|
226 | + function(Field $field) { |
|
227 | 227 | return $field->getRenderable('title', false); |
228 | 228 | } |
229 | 229 | ); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | 'keyAttribute' => $this->keyAttribute, |
251 | 251 | 'spinner' => $spinner, |
252 | 252 | 'tablelist' => $table->getRenderHTML(), |
253 | - 'tableItemFields' => array_keys(array_map(function (Field $f) { |
|
253 | + 'tableItemFields' => array_keys(array_map(function(Field $f) { |
|
254 | 254 | return $f->getName(); |
255 | 255 | }, $this->tableFields)), |
256 | 256 | 'typeTitle' => $this->studlyName, |
@@ -328,13 +328,13 @@ discard block |
||
328 | 328 | * card |
329 | 329 | */ |
330 | 330 | $cardFieldNames = array_map( |
331 | - function (Field $field) { |
|
331 | + function(Field $field) { |
|
332 | 332 | return $field->getName(); |
333 | 333 | }, |
334 | 334 | $this->cardFields |
335 | 335 | ); |
336 | 336 | $graphqlQuery = $this->fModel->mapFields( |
337 | - function (Field $f) use ($cardFieldNames) { |
|
337 | + function(Field $f) use ($cardFieldNames) { |
|
338 | 338 | if (in_array($f->getName(), $cardFieldNames)) { |
339 | 339 | // TODO: filter subfields in relationships |
340 | 340 | return $f->toGraphqlQuery(); |
@@ -350,8 +350,8 @@ discard block |
||
350 | 350 | $filtersQuery = ', ' . join( |
351 | 351 | ', ', |
352 | 352 | array_map( |
353 | - function ($item) { |
|
354 | - return '$' . $item['name'] . ': ' . $item['type'] . ($item['required'] ? '!' : ''); |
|
353 | + function($item) { |
|
354 | + return '$' . $item['name'] . ': ' . $item['type'] . ($item['required'] ? '!' : ''); |
|
355 | 355 | }, |
356 | 356 | $filters |
357 | 357 | ) |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | $filtersParams = ', ' . join( |
360 | 360 | ', ', |
361 | 361 | array_map( |
362 | - function ($item) { |
|
362 | + function($item) { |
|
363 | 363 | return $item['name'] . ': $' . $item['name']; |
364 | 364 | }, |
365 | 365 | $filters |
@@ -398,14 +398,14 @@ discard block |
||
398 | 398 | * table |
399 | 399 | */ |
400 | 400 | $tableFieldNames = array_map( |
401 | - function (Field $field) { |
|
401 | + function(Field $field) { |
|
402 | 402 | return $field->getName(); |
403 | 403 | }, |
404 | 404 | $this->tableFields |
405 | 405 | ); |
406 | 406 | |
407 | 407 | $graphqlQuery = $this->fModel->mapFields( |
408 | - function (Field $f) use ($tableFieldNames) { |
|
408 | + function(Field $f) use ($tableFieldNames) { |
|
409 | 409 | if (in_array($f->getName(), $tableFieldNames)) { |
410 | 410 | // TODO: filter subfields in relationships |
411 | 411 | return $f->toGraphqlQuery(); |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | * item |
446 | 446 | */ |
447 | 447 | $graphqlQuery = $this->fModel->mapFields( |
448 | - function (Field $f) { |
|
448 | + function(Field $f) { |
|
449 | 449 | return \Modelarium\Frontend\Util::fieldShow($f) ? $f->toGraphqlQuery() : null; |
450 | 450 | } |
451 | 451 | ); |