@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | "$this->viewPrefix.index", |
| 331 | 331 | "twill::$this->moduleName.index", |
| 332 | 332 | "twill::layouts.listing", |
| 333 | - ])->first(function ($view) { |
|
| 333 | + ])->first(function($view) { |
|
| 334 | 334 | return View::exists($view); |
| 335 | 335 | }); |
| 336 | 336 | |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | "$this->viewPrefix.form", |
| 422 | 422 | "twill::$this->moduleName.form", |
| 423 | 423 | "twill::layouts.form", |
| 424 | - ])->first(function ($view) { |
|
| 424 | + ])->first(function($view) { |
|
| 425 | 425 | return View::exists($view); |
| 426 | 426 | }); |
| 427 | 427 | |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | "$this->viewPrefix.form", |
| 538 | 538 | "twill::$this->moduleName.form", |
| 539 | 539 | "twill::layouts.form", |
| 540 | - ])->first(function ($view) { |
|
| 540 | + ])->first(function($view) { |
|
| 541 | 541 | return View::exists($view); |
| 542 | 542 | }); |
| 543 | 543 | |
@@ -784,7 +784,7 @@ discard block |
||
| 784 | 784 | $query = $this->request->input('q'); |
| 785 | 785 | $tags = $this->repository->getTags($query); |
| 786 | 786 | |
| 787 | - return Response::json(['items' => $tags->map(function ($tag) { |
|
| 787 | + return Response::json(['items' => $tags->map(function($tag) { |
|
| 788 | 788 | return $tag->name; |
| 789 | 789 | })], 200); |
| 790 | 790 | } |
@@ -871,8 +871,8 @@ discard block |
||
| 871 | 871 | protected function getIndexTableData($items) |
| 872 | 872 | { |
| 873 | 873 | $translated = $this->moduleHas('translations'); |
| 874 | - return $items->map(function ($item) use ($translated) { |
|
| 875 | - $columnsData = Collection::make($this->indexColumns)->mapWithKeys(function ($column) use ($item) { |
|
| 874 | + return $items->map(function($item) use ($translated) { |
|
| 875 | + $columnsData = Collection::make($this->indexColumns)->mapWithKeys(function($column) use ($item) { |
|
| 876 | 876 | return $this->getItemColumnData($item, $column); |
| 877 | 877 | })->toArray(); |
| 878 | 878 | |
@@ -1129,7 +1129,7 @@ discard block |
||
| 1129 | 1129 | 'feature', |
| 1130 | 1130 | 'bulkFeature', |
| 1131 | 1131 | 'bulkDelete', |
| 1132 | - ])->mapWithKeys(function ($endpoint) { |
|
| 1132 | + ])->mapWithKeys(function($endpoint) { |
|
| 1133 | 1133 | return [ |
| 1134 | 1134 | $endpoint . 'Url' => $this->getIndexOption($endpoint) ? moduleRoute( |
| 1135 | 1135 | $this->moduleName, $this->routePrefix, $endpoint, |
@@ -1145,7 +1145,7 @@ discard block |
||
| 1145 | 1145 | */ |
| 1146 | 1146 | protected function getIndexOption($option) |
| 1147 | 1147 | { |
| 1148 | - return once(function () use ($option) { |
|
| 1148 | + return once(function() use ($option) { |
|
| 1149 | 1149 | $customOptionNamesMapping = [ |
| 1150 | 1150 | 'store' => 'create', |
| 1151 | 1151 | ]; |
@@ -1201,8 +1201,8 @@ discard block |
||
| 1201 | 1201 | { |
| 1202 | 1202 | $withImage = $this->moduleHas('medias'); |
| 1203 | 1203 | |
| 1204 | - return $items->map(function ($item) use ($withImage) { |
|
| 1205 | - $columnsData = Collection::make($this->browserColumns)->mapWithKeys(function ($column) use ($item) { |
|
| 1204 | + return $items->map(function($item) use ($withImage) { |
|
| 1205 | + $columnsData = Collection::make($this->browserColumns)->mapWithKeys(function($column) use ($item) { |
|
| 1206 | 1206 | return $this->getItemColumnData($item, $column); |
| 1207 | 1207 | })->toArray(); |
| 1208 | 1208 | |
@@ -1268,7 +1268,7 @@ discard block |
||
| 1268 | 1268 | $fieldSplitted = explode('|', $field); |
| 1269 | 1269 | if (count($fieldSplitted) > 1) { |
| 1270 | 1270 | $requestValue = $requestFilters[$key]; |
| 1271 | - Collection::make($fieldSplitted)->each(function ($scopeKey) use (&$scope, $requestValue) { |
|
| 1271 | + Collection::make($fieldSplitted)->each(function($scopeKey) use (&$scope, $requestValue) { |
|
| 1272 | 1272 | $scope[$scopeKey] = $requestValue; |
| 1273 | 1273 | }); |
| 1274 | 1274 | } else { |
@@ -1435,11 +1435,11 @@ discard block |
||
| 1435 | 1435 | */ |
| 1436 | 1436 | protected function validateFormRequest() |
| 1437 | 1437 | { |
| 1438 | - $unauthorizedFields = Collection::make($this->fieldsPermissions)->filter(function ($permission, $field) { |
|
| 1438 | + $unauthorizedFields = Collection::make($this->fieldsPermissions)->filter(function($permission, $field) { |
|
| 1439 | 1439 | return Auth::guard('twill_users')->user()->cannot($permission); |
| 1440 | 1440 | })->keys(); |
| 1441 | 1441 | |
| 1442 | - $unauthorizedFields->each(function ($field) { |
|
| 1442 | + $unauthorizedFields->each(function($field) { |
|
| 1443 | 1443 | $this->request->offsetUnset($field); |
| 1444 | 1444 | }); |
| 1445 | 1445 | |
@@ -1679,7 +1679,7 @@ discard block |
||
| 1679 | 1679 | */ |
| 1680 | 1680 | public function getRepeaterList() |
| 1681 | 1681 | { |
| 1682 | - return app(BlockCollection::class)->getRepeaterList()->mapWithKeys(function ($repeater) { |
|
| 1682 | + return app(BlockCollection::class)->getRepeaterList()->mapWithKeys(function($repeater) { |
|
| 1683 | 1683 | return [$repeater['name'] => $repeater]; |
| 1684 | 1684 | }); |
| 1685 | 1685 | } |
@@ -65,14 +65,14 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | return collect( |
| 67 | 67 | config('twill.block_editor.directories.source.icons') |
| 68 | - )->reduce(function (Collection $keep, $path) { |
|
| 68 | + )->reduce(function(Collection $keep, $path) { |
|
| 69 | 69 | if (!$this->files->exists($path)) { |
| 70 | 70 | $this->displayError("Directory not found: {$path}"); |
| 71 | 71 | |
| 72 | 72 | return $keep; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - $files = collect($this->files->files($path))->map(function ( |
|
| 75 | + $files = collect($this->files->files($path))->map(function( |
|
| 76 | 76 | SplFileInfo $file |
| 77 | 77 | ) { |
| 78 | 78 | return [ |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function handle() |
| 94 | 94 | { |
| 95 | - $icons = $this->getIconList()->filter(function ($icon) { |
|
| 95 | + $icons = $this->getIconList()->filter(function($icon) { |
|
| 96 | 96 | return $this->isAllowed($icon); |
| 97 | 97 | }); |
| 98 | 98 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function byKey($key, $section = null) |
| 36 | 36 | { |
| 37 | - return $this->model->when($section, function ($query) use ($section) { |
|
| 37 | + return $this->model->when($section, function($query) use ($section) { |
|
| 38 | 38 | $query->where('section', $section); |
| 39 | 39 | })->where('key', $key)->exists() ? $this->model->where('key', $key)->with('translations')->first()->value : null; |
| 40 | 40 | } |
@@ -45,13 +45,13 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function getFormFields($section = null) |
| 47 | 47 | { |
| 48 | - $settings = $this->model->when($section, function ($query) use ($section) { |
|
| 48 | + $settings = $this->model->when($section, function($query) use ($section) { |
|
| 49 | 49 | $query->where('section', $section); |
| 50 | 50 | })->with('translations', 'medias')->get(); |
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | if (config('twill.media_library.translated_form_fields', false)) { |
| 54 | - $medias = $settings->reduce(function ($carry, $setting) { |
|
| 54 | + $medias = $settings->reduce(function($carry, $setting) { |
|
| 55 | 55 | foreach (getLocales() as $locale) { |
| 56 | 56 | if (!empty(parent::getFormFields($setting)['medias'][$locale]) && !empty(parent::getFormFields($setting)['medias'][$locale][$setting->key])) |
| 57 | 57 | { |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | return $carry; |
| 62 | 62 | }); |
| 63 | 63 | } else { |
| 64 | - $medias = $settings->mapWithKeys(function ($setting) { |
|
| 64 | + $medias = $settings->mapWithKeys(function($setting) { |
|
| 65 | 65 | return [$setting->key => parent::getFormFields($setting)['medias'][$setting->key] ?? null]; |
| 66 | 66 | })->filter()->toArray(); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - return $settings->mapWithKeys(function ($setting) { |
|
| 69 | + return $settings->mapWithKeys(function($setting) { |
|
| 70 | 70 | $settingValue = []; |
| 71 | 71 | |
| 72 | 72 | foreach ($setting->translations as $translation) { |
@@ -117,13 +117,13 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | if (config('twill.media_library.translated_form_fields', false)) { |
| 119 | 119 | foreach (getLocales() as $locale) { |
| 120 | - $medias["{$role}[{$locale}]"] = Collection::make($settingsFields['medias'][$role][$locale])->map(function ($media) { |
|
| 120 | + $medias["{$role}[{$locale}]"] = Collection::make($settingsFields['medias'][$role][$locale])->map(function($media) { |
|
| 121 | 121 | return json_decode($media, true); |
| 122 | 122 | })->filter()->toArray(); |
| 123 | 123 | } |
| 124 | 124 | } else { |
| 125 | - $medias = [ |
|
| 126 | - $role => Collection::make($settingsFields['medias'][$role])->mapWithKeys(function ($media, $key) { |
|
| 125 | + $medias = [ |
|
| 126 | + $role => Collection::make($settingsFields['medias'][$role])->mapWithKeys(function($media, $key) { |
|
| 127 | 127 | return json_decode($media, true); |
| 128 | 128 | })->values()->filter()->toArray(), |
| 129 | 129 | ]; |
@@ -50,12 +50,12 @@ discard block |
||
| 50 | 50 | public function findByName($search, $sources = []) |
| 51 | 51 | { |
| 52 | 52 | return $this->collect() |
| 53 | - ->filter(function ($block) use ($search, $sources) { |
|
| 53 | + ->filter(function($block) use ($search, $sources) { |
|
| 54 | 54 | return $block->name == $search && |
| 55 | 55 | (blank($sources) || |
| 56 | 56 | collect($sources)->contains($block->source)); |
| 57 | 57 | }) |
| 58 | - ->sortBy(function ($block) { |
|
| 58 | + ->sortBy(function($block) { |
|
| 59 | 59 | return $block->source === 'app' ? 0 : 1; |
| 60 | 60 | }) |
| 61 | 61 | ->first(); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | public function getBlocks() |
| 68 | 68 | { |
| 69 | 69 | return $this->collect() |
| 70 | - ->filter(function ($block) { |
|
| 70 | + ->filter(function($block) { |
|
| 71 | 71 | return $block->type === Block::TYPE_BLOCK; |
| 72 | 72 | }) |
| 73 | 73 | ->values(); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function getBlockList() |
| 80 | 80 | { |
| 81 | - return $this->getBlocks()->map(function (Block $block) { |
|
| 81 | + return $this->getBlocks()->map(function(Block $block) { |
|
| 82 | 82 | return $block->toList(); |
| 83 | 83 | }); |
| 84 | 84 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | return collect(); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - return collect($this->fileSystem->files($directory))->map(function ( |
|
| 108 | + return collect($this->fileSystem->files($directory))->map(function( |
|
| 109 | 109 | $file |
| 110 | 110 | ) use ($source, $type) { |
| 111 | 111 | return new Block($file, $type, $source); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $this->paths = collect( |
| 121 | 121 | config('twill.block_editor.directories.source.blocks') |
| 122 | 122 | ) |
| 123 | - ->map(function ($path) { |
|
| 123 | + ->map(function($path) { |
|
| 124 | 124 | $path['type'] = Block::TYPE_BLOCK; |
| 125 | 125 | |
| 126 | 126 | return $path; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | ->merge( |
| 129 | 129 | collect( |
| 130 | 130 | config('twill.block_editor.directories.source.repeaters') |
| 131 | - )->map(function ($path) { |
|
| 131 | + )->map(function($path) { |
|
| 132 | 132 | $path['type'] = Block::TYPE_REPEATER; |
| 133 | 133 | |
| 134 | 134 | return $path; |
@@ -166,12 +166,12 @@ discard block |
||
| 166 | 166 | $this->generatePaths(); |
| 167 | 167 | |
| 168 | 168 | $this->items = collect($this->paths) |
| 169 | - ->reduce(function (Collection $keep, $path) { |
|
| 169 | + ->reduce(function(Collection $keep, $path) { |
|
| 170 | 170 | $this->readBlocks( |
| 171 | 171 | $path['path'], |
| 172 | 172 | $path['source'], |
| 173 | 173 | $path['type'] |
| 174 | - )->each(function ($block) use ($keep) { |
|
| 174 | + )->each(function($block) use ($keep) { |
|
| 175 | 175 | $keep->push($block); |
| 176 | 176 | |
| 177 | 177 | return $keep; |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | ->toArray(); |
| 183 | 183 | |
| 184 | 184 | $this->items = $this->collect() |
| 185 | - ->each(function (Block $block) { |
|
| 185 | + ->each(function(Block $block) { |
|
| 186 | 186 | $block->setSource($this->detectCustomSources($block)); |
| 187 | 187 | }) |
| 188 | 188 | ->toArray(); |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | */ |
| 204 | 204 | public function list() |
| 205 | 205 | { |
| 206 | - return $this->collect()->map(function (Block $block) { |
|
| 206 | + return $this->collect()->map(function(Block $block) { |
|
| 207 | 207 | return $block->toList(); |
| 208 | 208 | }); |
| 209 | 209 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | public function getRepeaters() |
| 223 | 223 | { |
| 224 | 224 | return $this->collect() |
| 225 | - ->filter(function ($block) { |
|
| 225 | + ->filter(function($block) { |
|
| 226 | 226 | return $block->type === Block::TYPE_REPEATER; |
| 227 | 227 | }) |
| 228 | 228 | ->values(); |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | */ |
| 234 | 234 | public function getRepeaterList() |
| 235 | 235 | { |
| 236 | - return $this->getRepeaters()->map(function (Block $block) { |
|
| 236 | + return $this->getRepeaters()->map(function(Block $block) { |
|
| 237 | 237 | return $block->toList(); |
| 238 | 238 | }); |
| 239 | 239 | } |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | { |
| 38 | 38 | $this->call('twill:make:module', [ |
| 39 | 39 | 'moduleName' => $this->argument('moduleName'), |
| 40 | - ] + collect($this->options())->mapWithKeys(function ($value, $key) { |
|
| 40 | + ] + collect($this->options())->mapWithKeys(function($value, $key) { |
|
| 41 | 41 | return ["--{$key}" => $value]; |
| 42 | 42 | })->toArray()); |
| 43 | 43 | } |
@@ -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 | return $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 | ) { |
@@ -20,12 +20,12 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | $icons = collect( |
| 22 | 22 | config('twill.block_editor.directories.source.icons') |
| 23 | - )->reduce(function (Collection $keep, $path) { |
|
| 23 | + )->reduce(function(Collection $keep, $path) { |
|
| 24 | 24 | if (!$this->files->exists($path)) { |
| 25 | 25 | return $keep; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - $files = collect($this->files->files($path))->map(function ( |
|
| 28 | + $files = collect($this->files->files($path))->map(function( |
|
| 29 | 29 | SplFileInfo $file |
| 30 | 30 | ) { |
| 31 | 31 | if (in_array($file->getFilename(), config('twill.internal_icons'))) { |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | abort(404); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - return response()->stream(function () use ($file) { |
|
| 57 | + return response()->stream(function() use ($file) { |
|
| 58 | 58 | echo $this->files->get($file); |
| 59 | 59 | }, 200, ["Content-Type" => "image/svg+xml"]); |
| 60 | 60 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | $this->blockCollection |
| 49 | 49 | ->getMissingDirectories() |
| 50 | - ->each(function ($directory) { |
|
| 50 | + ->each(function($directory) { |
|
| 51 | 51 | $this->error("Directory not found: {$directory}"); |
| 52 | 52 | }); |
| 53 | 53 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | return $blockCollection |
| 62 | 62 | ->first() |
| 63 | 63 | ->keys() |
| 64 | - ->map(function ($key) { |
|
| 64 | + ->map(function($key) { |
|
| 65 | 65 | return Str::studly($key); |
| 66 | 66 | }) |
| 67 | 67 | ->toArray(); |
@@ -81,20 +81,20 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | return $this->blockCollection |
| 83 | 83 | ->collect() |
| 84 | - ->reject(function (Block $block) use ($sourceFiltered) { |
|
| 84 | + ->reject(function(Block $block) use ($sourceFiltered) { |
|
| 85 | 85 | return $sourceFiltered && !$this->option($block->source); |
| 86 | 86 | }) |
| 87 | - ->reject(function (Block $block) use ($typeFiltered) { |
|
| 87 | + ->reject(function(Block $block) use ($typeFiltered) { |
|
| 88 | 88 | return $this->dontPassTextFilter($block) || |
| 89 | 89 | ($typeFiltered && |
| 90 | 90 | !$this->option(Str::plural($block->type))); |
| 91 | 91 | }) |
| 92 | - ->map(function (Block $block) { |
|
| 92 | + ->map(function(Block $block) { |
|
| 93 | 93 | return $this->colorize( |
| 94 | 94 | $this->option('short') ? $block->toShortList() : $block->toList() |
| 95 | 95 | ); |
| 96 | 96 | }) |
| 97 | - ->sortBy(function ($block) { |
|
| 97 | + ->sortBy(function($block) { |
|
| 98 | 98 | return [$block['group'], $block['title']]; |
| 99 | 99 | }); |
| 100 | 100 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | if (filled($filter = $this->argument('filter'))) { |
| 153 | 153 | return !$block |
| 154 | 154 | ->toList() |
| 155 | - ->reduce(function ($keep, $element) use ($filter) { |
|
| 155 | + ->reduce(function($keep, $element) use ($filter) { |
|
| 156 | 156 | return $keep || |
| 157 | 157 | Str::contains( |
| 158 | 158 | Str::lower($element), |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | |
| 354 | 354 | return collect( |
| 355 | 355 | config('twill.block_editor.directories.source.icons') |
| 356 | - )->reduce(function ($keep, $path) use ($icon) { |
|
| 356 | + )->reduce(function($keep, $path) use ($icon) { |
|
| 357 | 357 | if ($keep) { |
| 358 | 358 | return $keep; |
| 359 | 359 | } |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | return null; |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | - return collect($this->files->files($path))->reduce(function ($keep, SplFileInfo $file) use ($icon) { |
|
| 365 | + return collect($this->files->files($path))->reduce(function($keep, SplFileInfo $file) use ($icon) { |
|
| 366 | 366 | if ($keep) { |
| 367 | 367 | return $keep; |
| 368 | 368 | } |