@@ -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; |
@@ -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 | "`)');"; |
@@ -19,7 +19,7 @@ |
||
19 | 19 | if (!count($indexFields)) { |
20 | 20 | throw new Exception("You must provide at least one field to an index"); |
21 | 21 | } |
22 | - $generator->createCode[] = '$table->index(["' . implode('", "', $indexFields) .'"]);'; |
|
22 | + $generator->createCode[] = '$table->index(["' . implode('", "', $indexFields) . '"]);'; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | public static function processMigrationFieldDirective( |
@@ -56,7 +56,7 @@ |
||
56 | 56 | if (!count($indexFields)) { |
57 | 57 | throw new Exception("You must provide at least one field to an index on a model"); |
58 | 58 | } |
59 | - $generator->createCode[] = '$table->unique(["' . implode('", "', $indexFields) .'"]);'; |
|
59 | + $generator->createCode[] = '$table->unique(["' . implode('", "', $indexFields) . '"]);'; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | public static function processMigrationFieldDirective( |
@@ -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 | ); |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | 'keyAttribute' => $this->keyAttribute, |
250 | 250 | 'spinner' => $spinner, |
251 | 251 | 'tablelist' => $table->getRenderHTML(), |
252 | - 'tableItemFields' => array_keys(array_map(function (Field $f) { |
|
252 | + 'tableItemFields' => array_keys(array_map(function(Field $f) { |
|
253 | 253 | return $f->getName(); |
254 | 254 | }, $this->tableFields)), |
255 | 255 | 'typeTitle' => $this->fModel->getRenderable('name', $this->studlyName), |
@@ -327,13 +327,13 @@ discard block |
||
327 | 327 | * card |
328 | 328 | */ |
329 | 329 | $cardFieldNames = array_map( |
330 | - function (Field $field) { |
|
330 | + function(Field $field) { |
|
331 | 331 | return $field->getName(); |
332 | 332 | }, |
333 | 333 | $this->cardFields |
334 | 334 | ); |
335 | 335 | $graphqlQuery = $this->fModel->mapFields( |
336 | - function (Field $f) use ($cardFieldNames) { |
|
336 | + function(Field $f) use ($cardFieldNames) { |
|
337 | 337 | if (in_array($f->getName(), $cardFieldNames)) { |
338 | 338 | // TODO: filter subfields in relationships |
339 | 339 | return $f->toGraphqlQuery(); |
@@ -349,8 +349,8 @@ discard block |
||
349 | 349 | $filtersQuery = ', ' . join( |
350 | 350 | ', ', |
351 | 351 | array_map( |
352 | - function ($item) { |
|
353 | - return '$' . $item['name'] . ': ' . $item['type'] . ($item['required'] ? '!' : ''); |
|
352 | + function($item) { |
|
353 | + return '$' . $item['name'] . ': ' . $item['type'] . ($item['required'] ? '!' : ''); |
|
354 | 354 | }, |
355 | 355 | $filters |
356 | 356 | ) |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | $filtersParams = ', ' . join( |
359 | 359 | ', ', |
360 | 360 | array_map( |
361 | - function ($item) { |
|
361 | + function($item) { |
|
362 | 362 | return $item['name'] . ': $' . $item['name']; |
363 | 363 | }, |
364 | 364 | $filters |
@@ -397,14 +397,14 @@ discard block |
||
397 | 397 | * table |
398 | 398 | */ |
399 | 399 | $tableFieldNames = array_map( |
400 | - function (Field $field) { |
|
400 | + function(Field $field) { |
|
401 | 401 | return $field->getName(); |
402 | 402 | }, |
403 | 403 | $this->tableFields |
404 | 404 | ); |
405 | 405 | |
406 | 406 | $graphqlQuery = $this->fModel->mapFields( |
407 | - function (Field $f) use ($tableFieldNames) { |
|
407 | + function(Field $f) use ($tableFieldNames) { |
|
408 | 408 | if (in_array($f->getName(), $tableFieldNames)) { |
409 | 409 | // TODO: filter subfields in relationships |
410 | 410 | return $f->toGraphqlQuery(); |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | * item |
445 | 445 | */ |
446 | 446 | $graphqlQuery = $this->fModel->mapFields( |
447 | - function (Field $f) { |
|
447 | + function(Field $f) { |
|
448 | 448 | return \Modelarium\Frontend\Util::fieldShow($f) ? $f->toGraphqlQuery() : null; |
449 | 449 | } |
450 | 450 | ); |
@@ -47,7 +47,7 @@ |
||
47 | 47 | */ |
48 | 48 | public static function scalars(array $datatypes, string $ns): array |
49 | 49 | { |
50 | - $graphql = [ '# File automatically generated by Modelarium' ]; |
|
50 | + $graphql = ['# File automatically generated by Modelarium']; |
|
51 | 51 | |
52 | 52 | foreach ($datatypes as $name) { |
53 | 53 | $typeName = Str::studly($name); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | Button::TYPE => ($hasVueRouter ? 'router-link' : 'a'), |
85 | 85 | Button::ATTRIBUTES => [ |
86 | 86 | $targetAttribute => "/{$routeBase}/edit", |
87 | - ] + ($hasCan ? [ "v-if" => 'can.create' ]: []), |
|
87 | + ] + ($hasCan ? ["v-if" => 'can.create'] : []), |
|
88 | 88 | ] |
89 | 89 | )->setContent( |
90 | 90 | '<i class="fa fa-plus"></i> Add new', |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | Button::TYPE => ($hasVueRouter ? 'router-link' : 'a'), |
99 | 99 | Button::ATTRIBUTES => [ |
100 | 100 | $targetAttribute => "'/{$routeBase}/' + model.{$keyAttribute} + '/edit'", |
101 | - ] + ($hasCan ? [ "v-if" => 'can.edit' ]: []), |
|
101 | + ] + ($hasCan ? ["v-if" => 'can.edit'] : []), |
|
102 | 102 | ] |
103 | 103 | )->setContent( |
104 | 104 | '<i class="fa fa-pencil"></i> Edit', |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | Button::ATTRIBUTES => [ |
115 | 115 | 'href' => '#', |
116 | 116 | '@click.prevent' => 'remove', |
117 | - ] + ($hasCan ? [ "v-if" => 'can.delete' ]: []), |
|
117 | + ] + ($hasCan ? ["v-if" => 'can.delete'] : []), |
|
118 | 118 | ] |
119 | 119 | )->setContent( |
120 | 120 | '<i class="fa fa-trash"></i> Delete', |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $this->generator->templateParameters['buttonDelete'] = $buttonDelete; |
128 | 128 | |
129 | 129 | $this->generator->templateParameters['tableItemFields'] = |
130 | - array_values(array_map(function (Field $f) { |
|
130 | + array_values(array_map(function(Field $f) { |
|
131 | 131 | if ($f->getDatatype()->getBasetype() === 'relationship') { |
132 | 132 | $name = $f->getName(); |
133 | 133 | return "<{$name}-link v-bind=\"{$name}\"></{$name}-link>"; |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | 'required' => true |
213 | 213 | ] |
214 | 214 | ]; |
215 | - $cardFieldNames = array_map(function (Field $f) { |
|
215 | + $cardFieldNames = array_map(function(Field $f) { |
|
216 | 216 | return $f->getName(); |
217 | 217 | }, $this->generator->getCardFields()); |
218 | 218 | $vueCode->setExtraProps($extraprops); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | ] |
241 | 241 | ]; |
242 | 242 | $vueCode->setExtraProps($extraprops); |
243 | - $cardFieldNames = array_map(function (Field $f) { |
|
243 | + $cardFieldNames = array_map(function(Field $f) { |
|
244 | 244 | return $f->getName(); |
245 | 245 | }, $this->generator->getCardFields()); |
246 | 246 | foreach ($this->generator->getCardFields() as $f) { |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | public function vueTableItem(FrameworkVue $vue): void |
266 | 266 | { |
267 | 267 | $vueCode = $vue->getVueCode(); |
268 | - $tableFieldNames = array_map(function (Field $f) { |
|
268 | + $tableFieldNames = array_map(function(Field $f) { |
|
269 | 269 | return $f->getName(); |
270 | 270 | }, $this->generator->getTableFields()); |
271 | 271 | $extraprops = [ |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $vue, |
298 | 298 | 'Form', |
299 | 299 | 'editable', |
300 | - function (Field $f) { |
|
300 | + function(Field $f) { |
|
301 | 301 | if (!$f->getExtradata('modelFillable')) { |
302 | 302 | return false; |
303 | 303 | } |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | |
323 | 323 | if ($mode == 'editable') { |
324 | 324 | $vue->setEditableTemplate( |
325 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
325 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
326 | 326 | return $this->generator->templateCallback($stub, $vue, $data, $m); |
327 | 327 | } |
328 | 328 | ); |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | ); |
337 | 337 | } else { |
338 | 338 | $vue->setViewableTemplate( |
339 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
339 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
340 | 340 | return $this->generator->templateCallback($stub, $vue, $data, $m); |
341 | 341 | } |
342 | 342 | ); |
@@ -368,14 +368,14 @@ discard block |
||
368 | 368 | ]; |
369 | 369 | |
370 | 370 | $import = array_map( |
371 | - function ($i) use ($name) { |
|
371 | + function($i) use ($name) { |
|
372 | 372 | return "import {$name}$i from './{$name}$i.vue';"; |
373 | 373 | }, |
374 | 374 | $items |
375 | 375 | ); |
376 | 376 | |
377 | 377 | $export = array_map( |
378 | - function ($i) use ($name) { |
|
378 | + function($i) use ($name) { |
|
379 | 379 | return " {$name}$i,"; |
380 | 380 | }, |
381 | 381 | $items |