@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | Button::TYPE => ($hasVueRouter ? 'router-link' : 'a'), |
| 100 | 100 | Button::ATTRIBUTES => [ |
| 101 | 101 | $targetAttribute => "/{$routeBase}/edit", |
| 102 | - ] + ($hasCan ? [ "v-if" => 'can(\'create\')' ]: []), |
|
| 102 | + ] + ($hasCan ? ["v-if" => 'can(\'create\')'] : []), |
|
| 103 | 103 | ] |
| 104 | 104 | )->setContent( |
| 105 | 105 | '<i class="fa fa-plus"></i> ' . $this->getOptions()->getOption('frontend', 'messages')['addNew'], |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | Button::TYPE => ($hasVueRouter ? 'router-link' : 'a'), |
| 114 | 114 | Button::ATTRIBUTES => [ |
| 115 | 115 | $targetAttribute => "'/{$routeBase}/' + model.{$keyAttribute} + '/edit'", |
| 116 | - ] + ($hasCan ? [ "v-if" => 'can(\'edit\')' ]: []), |
|
| 116 | + ] + ($hasCan ? ["v-if" => 'can(\'edit\')'] : []), |
|
| 117 | 117 | ] |
| 118 | 118 | )->setContent( |
| 119 | 119 | '<i class="fa fa-pencil"></i> ' . $this->getOptions()->getOption('frontend', 'messages')['edit'], |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | Button::ATTRIBUTES => [ |
| 130 | 130 | 'href' => '#', |
| 131 | 131 | '@click.prevent' => 'remove(model.id)', |
| 132 | - ] + ($hasCan ? [ "v-if" => 'can(\'delete\')' ]: []), |
|
| 132 | + ] + ($hasCan ? ["v-if" => 'can(\'delete\')'] : []), |
|
| 133 | 133 | ] |
| 134 | 134 | )->setContent( |
| 135 | 135 | '<i class="fa fa-trash"></i> ' . $this->getOptions()->getOption('frontend', 'messages')['delete'], |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $this->generator->templateParameters['options'] = $this->getOptions()->options; |
| 150 | 150 | |
| 151 | 151 | $this->generator->templateParameters['tableItemFields'] = |
| 152 | - array_values(array_map(function (Field $f) { |
|
| 152 | + array_values(array_map(function(Field $f) { |
|
| 153 | 153 | $required = $f->getValidator('required', false); |
| 154 | 154 | if ($f->getDatatype()->getBasetype() === 'relationship') { |
| 155 | 155 | $name = $f->getName(); |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | 'required' => true |
| 246 | 246 | ] |
| 247 | 247 | ]; |
| 248 | - $cardFieldNames = array_map(function (Field $f) { |
|
| 248 | + $cardFieldNames = array_map(function(Field $f) { |
|
| 249 | 249 | return $f->getName(); |
| 250 | 250 | }, $this->generator->getCardFields()); |
| 251 | 251 | $vueCode->setExtraProps($extraprops); |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | $vueCode = $vue->getVueCode(); |
| 272 | 272 | // set basic data for vue |
| 273 | 273 | $vueCode->setExtraProps([]); |
| 274 | - $cardFieldNames = array_map(function (Field $f) { |
|
| 274 | + $cardFieldNames = array_map(function(Field $f) { |
|
| 275 | 275 | return $f->getName(); |
| 276 | 276 | }, $this->generator->getCardFields()); |
| 277 | 277 | foreach ($this->generator->getCardFields() as $f) { |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | public function vueTableItem(FrameworkVue $vue): void |
| 305 | 305 | { |
| 306 | 306 | $vueCode = $vue->getVueCode(); |
| 307 | - $tableFieldNames = array_map(function (Field $f) { |
|
| 307 | + $tableFieldNames = array_map(function(Field $f) { |
|
| 308 | 308 | return $f->getName(); |
| 309 | 309 | }, $this->generator->getTableFields()); |
| 310 | 310 | $vueCode->setExtraProps([]); |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | $vueCode->setExtraProps([]); |
| 352 | 352 | |
| 353 | 353 | $createGraphqlVariables = $this->generator->getModel()->mapFields( |
| 354 | - function (Field $f) { |
|
| 354 | + function(Field $f) { |
|
| 355 | 355 | if (!$f->getRenderable('form', true)) { |
| 356 | 356 | return null; |
| 357 | 357 | } |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | $vue, |
| 373 | 373 | 'Form', |
| 374 | 374 | 'editable', |
| 375 | - function (Field $f) { |
|
| 375 | + function(Field $f) { |
|
| 376 | 376 | if (!$f->getExtradata('modelFillable')) { |
| 377 | 377 | return false; |
| 378 | 378 | } |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | |
| 398 | 398 | if ($mode == 'editable') { |
| 399 | 399 | $vue->setEditableTemplate( |
| 400 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 400 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 401 | 401 | return $this->generator->templateCallback($stub, $vue, $data, $m); |
| 402 | 402 | } |
| 403 | 403 | ); |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | ); |
| 412 | 412 | } else { |
| 413 | 413 | $vue->setViewableTemplate( |
| 414 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 414 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 415 | 415 | return $this->generator->templateCallback($stub, $vue, $data, $m); |
| 416 | 416 | } |
| 417 | 417 | ); |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | $path = $this->generator->getModel()->getName() . '/index.js'; |
| 434 | 434 | $name = $this->generator->getStudlyName(); |
| 435 | 435 | |
| 436 | - $contents = function ($basepath, $element) use ($name) { |
|
| 436 | + $contents = function($basepath, $element) use ($name) { |
|
| 437 | 437 | $dir = $basepath . '/' . $name; |
| 438 | 438 | $import = []; |
| 439 | 439 | $export = []; |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | $path = $this->generator->getModel()->getName() . '/index.dynamic.js'; |
| 464 | 464 | $name = $this->generator->getStudlyName(); |
| 465 | 465 | |
| 466 | - $contents = function ($basepath, $element) use ($name) { |
|
| 466 | + $contents = function($basepath, $element) use ($name) { |
|
| 467 | 467 | $dir = $basepath . '/' . $name; |
| 468 | 468 | $import = []; |
| 469 | 469 | $export = []; |
@@ -154,17 +154,17 @@ discard block |
||
| 154 | 154 | public function buildTemplateParameters(): void |
| 155 | 155 | { |
| 156 | 156 | $this->titleFields = $this->fModel->filterField( |
| 157 | - function (Field $field) { |
|
| 157 | + function(Field $field) { |
|
| 158 | 158 | return $field->getRenderable('title', false); |
| 159 | 159 | } |
| 160 | 160 | ); |
| 161 | 161 | $this->cardFields = $this->fModel->filterField( |
| 162 | - function (Field $field) { |
|
| 162 | + function(Field $field) { |
|
| 163 | 163 | return $field->getRenderable('card', false); |
| 164 | 164 | } |
| 165 | 165 | ); |
| 166 | 166 | $this->tableFields = $this->fModel->filterField( |
| 167 | - function (Field $field) { |
|
| 167 | + function(Field $field) { |
|
| 168 | 168 | return $field->getRenderable('table', false); |
| 169 | 169 | } |
| 170 | 170 | ); |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | ], |
| 179 | 179 | ] |
| 180 | 180 | )->setContent( |
| 181 | - '<i class="fa fa-plus"></i> ' . $this->getOptions()->getOption('frontend', 'messages')['addNew'], |
|
| 181 | + '<i class="fa fa-plus"></i> ' . $this->getOptions()->getOption('frontend', 'messages')['addNew'], |
|
| 182 | 182 | true, |
| 183 | 183 | true |
| 184 | 184 | )->getRenderHTML(); |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | 'Table', |
| 221 | 221 | [ |
| 222 | 222 | Table::ROW_NAMES => array_map( |
| 223 | - function (Field $field) { |
|
| 223 | + function(Field $field) { |
|
| 224 | 224 | return $field->getRenderable(Renderable::LABEL, $field->getName()); |
| 225 | 225 | }, |
| 226 | 226 | $this->tableFields |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | $t->appendContent('<slot name="extraHeaders" :props="$props"></slot>', true); |
| 246 | 246 | } |
| 247 | 247 | $titleFields = $this->fModel->filterField( |
| 248 | - function (Field $field) { |
|
| 248 | + function(Field $field) { |
|
| 249 | 249 | return $field->getRenderable('title', false); |
| 250 | 250 | } |
| 251 | 251 | ); |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | 'spinner' => $spinner, |
| 273 | 273 | 'routeBase' => $this->getRouteBase(), |
| 274 | 274 | 'tablelist' => $table->getRenderHTML(), |
| 275 | - 'tableItemFields' => array_keys(array_map(function (Field $f) { |
|
| 275 | + 'tableItemFields' => array_keys(array_map(function(Field $f) { |
|
| 276 | 276 | return $f->getName(); |
| 277 | 277 | }, $this->tableFields)), |
| 278 | 278 | 'typeTitle' => $this->fModel->getRenderable('name', $this->studlyName), |
@@ -350,13 +350,13 @@ discard block |
||
| 350 | 350 | $filters[] = [ |
| 351 | 351 | 'name' => $arg->name, |
| 352 | 352 | 'type' => $typename, |
| 353 | - 'graphqlType' => $arg->name . ': ' . |
|
| 353 | + 'graphqlType' => $arg->name . ': ' . |
|
| 354 | 354 | ($isArray ? '[' : '') . |
| 355 | 355 | $typename . |
| 356 | 356 | $isInternalRequiredString . // TODO: phpstan complains, issue with graphqlphp ($isInternalRequired ? '!' : '') . |
| 357 | 357 | ($isArray ? ']' : '') . |
| 358 | 358 | ($isRequired ? '!' : ''), |
| 359 | - 'required' => (bool)$isRequired, |
|
| 359 | + 'required' => (bool) $isRequired, |
|
| 360 | 360 | 'requiredJSBoolean' => $isRequired ? 'true' : 'false' |
| 361 | 361 | ]; |
| 362 | 362 | } |
@@ -372,13 +372,13 @@ discard block |
||
| 372 | 372 | * card |
| 373 | 373 | */ |
| 374 | 374 | $cardFieldNames = array_map( |
| 375 | - function (Field $field) { |
|
| 375 | + function(Field $field) { |
|
| 376 | 376 | return $field->getName(); |
| 377 | 377 | }, |
| 378 | 378 | $this->cardFields |
| 379 | 379 | ); |
| 380 | 380 | $graphqlQuery = $this->fModel->mapFields( |
| 381 | - function (Field $f) use ($cardFieldNames) { |
|
| 381 | + function(Field $f) use ($cardFieldNames) { |
|
| 382 | 382 | if (in_array($f->getName(), $cardFieldNames)) { |
| 383 | 383 | // TODO: filter subfields in relationships |
| 384 | 384 | return $f->toGraphqlQuery(); |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | $filtersQuery = ', ' . join( |
| 395 | 395 | ', ', |
| 396 | 396 | array_map( |
| 397 | - function ($item) { |
|
| 397 | + function($item) { |
|
| 398 | 398 | // TODO: still buggy, misses the internal ! in [Xyz!]! |
| 399 | 399 | return '$' . $item['graphqlType']; |
| 400 | 400 | }, |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | $filtersParams = ', ' . join( |
| 405 | 405 | ', ', |
| 406 | 406 | array_map( |
| 407 | - function ($item) { |
|
| 407 | + function($item) { |
|
| 408 | 408 | return $item['name'] . ': $' . $item['name']; |
| 409 | 409 | }, |
| 410 | 410 | $filters |
@@ -443,14 +443,14 @@ discard block |
||
| 443 | 443 | * table |
| 444 | 444 | */ |
| 445 | 445 | $tableFieldNames = array_map( |
| 446 | - function (Field $field) { |
|
| 446 | + function(Field $field) { |
|
| 447 | 447 | return $field->getName(); |
| 448 | 448 | }, |
| 449 | 449 | $this->tableFields |
| 450 | 450 | ); |
| 451 | 451 | |
| 452 | 452 | $graphqlQuery = $this->fModel->mapFields( |
| 453 | - function (Field $f) use ($tableFieldNames) { |
|
| 453 | + function(Field $f) use ($tableFieldNames) { |
|
| 454 | 454 | if (in_array($f->getName(), $tableFieldNames)) { |
| 455 | 455 | // TODO: filter subfields in relationships |
| 456 | 456 | return $f->toGraphqlQuery(); |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | * item |
| 491 | 491 | */ |
| 492 | 492 | $graphqlQuery = $this->fModel->mapFields( |
| 493 | - function (Field $f) { |
|
| 493 | + function(Field $f) { |
|
| 494 | 494 | return \Modelarium\Frontend\Util::fieldShow($f) ? $f->toGraphqlQuery() : null; |
| 495 | 495 | } |
| 496 | 496 | ); |