@@ -23,18 +23,18 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | public function __construct(array $attributes = []) |
| 25 | 25 | { |
| 26 | - $this->fillable(array_merge($this->fillable, Collection::make(config('twill.media_library.extra_metadatas_fields'))->map(function ($field) { |
|
| 26 | + $this->fillable(array_merge($this->fillable, Collection::make(config('twill.media_library.extra_metadatas_fields'))->map(function($field) { |
|
| 27 | 27 | return $field['name']; |
| 28 | 28 | })->toArray())); |
| 29 | 29 | |
| 30 | - Collection::make(config('twill.media_library.translatable_metadatas_fields'))->each(function ($field) { |
|
| 30 | + Collection::make(config('twill.media_library.translatable_metadatas_fields'))->each(function($field) { |
|
| 31 | 31 | $this->casts[$field] = 'json'; |
| 32 | 32 | }); |
| 33 | 33 | |
| 34 | 34 | parent::__construct($attributes); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function scopeUnused ($query) |
|
| 37 | + public function scopeUnused($query) |
|
| 38 | 38 | { |
| 39 | 39 | $usedIds = DB::table(config('twill.mediables_table'))->get()->pluck('media_id'); |
| 40 | 40 | return $query->whereNotIn('id', $usedIds->toArray())->get(); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | 'medium' => ImageService::getUrl($this->uuid, ["h" => "430"]), |
| 76 | 76 | 'width' => $this->width, |
| 77 | 77 | 'height' => $this->height, |
| 78 | - 'tags' => $this->tags->map(function ($tag) { |
|
| 78 | + 'tags' => $this->tags->map(function($tag) { |
|
| 79 | 79 | return $tag->name; |
| 80 | 80 | }), |
| 81 | 81 | 'deleteUrl' => $this->canDeleteSafely() ? moduleRoute('medias', 'media-library', 'destroy', $this->id) : null, |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | 'caption' => $this->caption, |
| 88 | 88 | 'altText' => $this->alt_text, |
| 89 | 89 | 'video' => null, |
| 90 | - ] + Collection::make(config('twill.media_library.extra_metadatas_fields'))->mapWithKeys(function ($field) { |
|
| 90 | + ] + Collection::make(config('twill.media_library.extra_metadatas_fields'))->mapWithKeys(function($field) { |
|
| 91 | 91 | return [ |
| 92 | 92 | $field['name'] => $this->{$field['name']}, |
| 93 | 93 | ]; |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | if ($this->update($fields) && $this->isReferenced()) |
| 144 | 144 | { |
| 145 | - DB::table(config('twill.mediables_table', 'twill_mediables'))->where('media_id', $this->id)->get()->each(function ($mediable) use ($prevWidth, $prevHeight) { |
|
| 145 | + DB::table(config('twill.mediables_table', 'twill_mediables'))->where('media_id', $this->id)->get()->each(function($mediable) use ($prevWidth, $prevHeight) { |
|
| 146 | 146 | |
| 147 | 147 | if ($prevWidth != $this->width) { |
| 148 | 148 | $mediable->crop_x = 0; |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $mediable->crop_h = $this->height; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - DB::table(config('twill.mediables_table', 'twill_mediables'))->where('id', $mediable->id)->update((array)$mediable); |
|
| 157 | + DB::table(config('twill.mediables_table', 'twill_mediables'))->where('id', $mediable->id)->update((array) $mediable); |
|
| 158 | 158 | }); |
| 159 | 159 | } |
| 160 | 160 | } |
@@ -240,8 +240,8 @@ |
||
| 240 | 240 | |
| 241 | 241 | // Title is mandatory |
| 242 | 242 | throw new Exception( |
| 243 | - "Block {$blockName} does not exists or the mandatory property '{$property}' ". |
|
| 244 | - "was not found on this block. If you are still using blocks on the twill.php ". |
|
| 243 | + "Block {$blockName} does not exists or the mandatory property '{$property}' " . |
|
| 244 | + "was not found on this block. If you are still using blocks on the twill.php " . |
|
| 245 | 245 | "file, please check if the block is present and properly configured." |
| 246 | 246 | ); |
| 247 | 247 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | if (!function_exists('dumpUsableSqlQuery')) { |
| 10 | 10 | function dumpUsableSqlQuery($query) |
| 11 | 11 | { |
| 12 | - dd(vsprintf(str_replace('?', '%s', $query->toSql()), array_map(function ($binding) { |
|
| 12 | + dd(vsprintf(str_replace('?', '%s', $query->toSql()), array_map(function($binding) { |
|
| 13 | 13 | return is_numeric($binding) ? $binding : "'{$binding}'"; |
| 14 | 14 | }, $query->getBindings()))); |
| 15 | 15 | } |
@@ -201,12 +201,12 @@ discard block |
||
| 201 | 201 | { |
| 202 | 202 | $blockList = app(BlockCollection::class)->getBlockList(); |
| 203 | 203 | |
| 204 | - $appBlocksList = $blockList->filter(function ($block) { |
|
| 204 | + $appBlocksList = $blockList->filter(function($block) { |
|
| 205 | 205 | return $block['source'] !== A17\Twill\Services\Blocks\Block::SOURCE_TWILL; |
| 206 | 206 | }); |
| 207 | 207 | |
| 208 | 208 | $finalBlockList = $blockList->filter( |
| 209 | - function ($block) use ($blocks, $groups, $appBlocksList) { |
|
| 209 | + function($block) use ($blocks, $groups, $appBlocksList) { |
|
| 210 | 210 | if ($block['group'] === A17\Twill\Services\Blocks\Block::SOURCE_TWILL) { |
| 211 | 211 | if (!collect( |
| 212 | 212 | config('twill.block_editor.use_twill_blocks') |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | if (count($appBlocksList) > 0 && $appBlocksList->contains( |
| 218 | - function ($appBlock) use ($block) { |
|
| 218 | + function($appBlock) use ($block) { |
|
| 219 | 219 | return $appBlock['name'] === $block['name']; |
| 220 | 220 | }) |
| 221 | 221 | ) { |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | |
| 44 | 44 | $this->call('twill:make:module', [ |
| 45 | 45 | 'moduleName' => $this->argument('moduleName'), |
| 46 | - ] + $options->mapWithKeys(function ($value, $key) { |
|
| 46 | + ] + $options->mapWithKeys(function($value, $key) { |
|
| 47 | 47 | return ["--{$key}" => $value]; |
| 48 | 48 | })->toArray()); |
| 49 | 49 | } |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | "$this->viewPrefix.index", |
| 356 | 356 | "twill::$this->moduleName.index", |
| 357 | 357 | "twill::layouts.listing", |
| 358 | - ])->first(function ($view) { |
|
| 358 | + ])->first(function($view) { |
|
| 359 | 359 | return View::exists($view); |
| 360 | 360 | }); |
| 361 | 361 | |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | "$this->viewPrefix.form", |
| 461 | 461 | "twill::$this->moduleName.form", |
| 462 | 462 | "twill::layouts.form", |
| 463 | - ])->first(function ($view) { |
|
| 463 | + ])->first(function($view) { |
|
| 464 | 464 | return View::exists($view); |
| 465 | 465 | }); |
| 466 | 466 | |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | "$this->viewPrefix.form", |
| 492 | 492 | "twill::$this->moduleName.form", |
| 493 | 493 | "twill::layouts.form", |
| 494 | - ])->first(function ($view) { |
|
| 494 | + ])->first(function($view) { |
|
| 495 | 495 | return View::exists($view); |
| 496 | 496 | }); |
| 497 | 497 | |
@@ -615,7 +615,7 @@ discard block |
||
| 615 | 615 | "$this->viewPrefix.form", |
| 616 | 616 | "twill::$this->moduleName.form", |
| 617 | 617 | "twill::layouts.form", |
| 618 | - ])->first(function ($view) { |
|
| 618 | + ])->first(function($view) { |
|
| 619 | 619 | return View::exists($view); |
| 620 | 620 | }); |
| 621 | 621 | |
@@ -863,7 +863,7 @@ discard block |
||
| 863 | 863 | $query = $this->request->input('q'); |
| 864 | 864 | $tags = $this->repository->getTags($query); |
| 865 | 865 | |
| 866 | - return Response::json(['items' => $tags->map(function ($tag) { |
|
| 866 | + return Response::json(['items' => $tags->map(function($tag) { |
|
| 867 | 867 | return $tag->name; |
| 868 | 868 | })], 200); |
| 869 | 869 | } |
@@ -951,8 +951,8 @@ discard block |
||
| 951 | 951 | protected function getIndexTableData($items) |
| 952 | 952 | { |
| 953 | 953 | $translated = $this->moduleHas('translations'); |
| 954 | - return $items->map(function ($item) use ($translated) { |
|
| 955 | - $columnsData = Collection::make($this->indexColumns)->mapWithKeys(function ($column) use ($item) { |
|
| 954 | + return $items->map(function($item) use ($translated) { |
|
| 955 | + $columnsData = Collection::make($this->indexColumns)->mapWithKeys(function($column) use ($item) { |
|
| 956 | 956 | return $this->getItemColumnData($item, $column); |
| 957 | 957 | })->toArray(); |
| 958 | 958 | |
@@ -1213,7 +1213,7 @@ discard block |
||
| 1213 | 1213 | 'feature', |
| 1214 | 1214 | 'bulkFeature', |
| 1215 | 1215 | 'bulkDelete', |
| 1216 | - ])->mapWithKeys(function ($endpoint) { |
|
| 1216 | + ])->mapWithKeys(function($endpoint) { |
|
| 1217 | 1217 | return [ |
| 1218 | 1218 | $endpoint . 'Url' => $this->getIndexOption($endpoint) ? moduleRoute( |
| 1219 | 1219 | $this->moduleName, |
@@ -1231,7 +1231,7 @@ discard block |
||
| 1231 | 1231 | */ |
| 1232 | 1232 | protected function getIndexOption($option) |
| 1233 | 1233 | { |
| 1234 | - return once(function () use ($option) { |
|
| 1234 | + return once(function() use ($option) { |
|
| 1235 | 1235 | $customOptionNamesMapping = [ |
| 1236 | 1236 | 'store' => 'create', |
| 1237 | 1237 | ]; |
@@ -1288,8 +1288,8 @@ discard block |
||
| 1288 | 1288 | { |
| 1289 | 1289 | $withImage = $this->moduleHas('medias'); |
| 1290 | 1290 | |
| 1291 | - return $items->map(function ($item) use ($withImage) { |
|
| 1292 | - $columnsData = Collection::make($this->browserColumns)->mapWithKeys(function ($column) use ($item) { |
|
| 1291 | + return $items->map(function($item) use ($withImage) { |
|
| 1292 | + $columnsData = Collection::make($this->browserColumns)->mapWithKeys(function($column) use ($item) { |
|
| 1293 | 1293 | return $this->getItemColumnData($item, $column); |
| 1294 | 1294 | })->toArray(); |
| 1295 | 1295 | |
@@ -1355,7 +1355,7 @@ discard block |
||
| 1355 | 1355 | $fieldSplitted = explode('|', $field); |
| 1356 | 1356 | if (count($fieldSplitted) > 1) { |
| 1357 | 1357 | $requestValue = $requestFilters[$key]; |
| 1358 | - Collection::make($fieldSplitted)->each(function ($scopeKey) use (&$scope, $requestValue) { |
|
| 1358 | + Collection::make($fieldSplitted)->each(function($scopeKey) use (&$scope, $requestValue) { |
|
| 1359 | 1359 | $scope[$scopeKey] = $requestValue; |
| 1360 | 1360 | }); |
| 1361 | 1361 | } else { |
@@ -1531,11 +1531,11 @@ discard block |
||
| 1531 | 1531 | */ |
| 1532 | 1532 | protected function validateFormRequest() |
| 1533 | 1533 | { |
| 1534 | - $unauthorizedFields = Collection::make($this->fieldsPermissions)->filter(function ($permission, $field) { |
|
| 1534 | + $unauthorizedFields = Collection::make($this->fieldsPermissions)->filter(function($permission, $field) { |
|
| 1535 | 1535 | return Auth::guard('twill_users')->user()->cannot($permission); |
| 1536 | 1536 | })->keys(); |
| 1537 | 1537 | |
| 1538 | - $unauthorizedFields->each(function ($field) { |
|
| 1538 | + $unauthorizedFields->each(function($field) { |
|
| 1539 | 1539 | $this->request->offsetUnset($field); |
| 1540 | 1540 | }); |
| 1541 | 1541 | |
@@ -1778,7 +1778,7 @@ discard block |
||
| 1778 | 1778 | */ |
| 1779 | 1779 | public function getRepeaterList() |
| 1780 | 1780 | { |
| 1781 | - return app(BlockCollection::class)->getRepeaterList()->mapWithKeys(function ($repeater) { |
|
| 1781 | + return app(BlockCollection::class)->getRepeaterList()->mapWithKeys(function($repeater) { |
|
| 1782 | 1782 | return [$repeater['name'] => $repeater]; |
| 1783 | 1783 | }); |
| 1784 | 1784 | } |