@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | "$this->viewPrefix.index", |
362 | 362 | "twill::$this->moduleName.index", |
363 | 363 | "twill::layouts.listing", |
364 | - ])->first(function ($view) { |
|
364 | + ])->first(function($view) { |
|
365 | 365 | return View::exists($view); |
366 | 366 | }); |
367 | 367 | |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | "$this->viewPrefix.form", |
471 | 471 | "twill::$this->moduleName.form", |
472 | 472 | "twill::layouts.form", |
473 | - ])->first(function ($view) { |
|
473 | + ])->first(function($view) { |
|
474 | 474 | return View::exists($view); |
475 | 475 | }); |
476 | 476 | |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | "$this->viewPrefix.form", |
502 | 502 | "twill::$this->moduleName.form", |
503 | 503 | "twill::layouts.form", |
504 | - ])->first(function ($view) { |
|
504 | + ])->first(function($view) { |
|
505 | 505 | return View::exists($view); |
506 | 506 | }); |
507 | 507 | |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | "$this->viewPrefix.form", |
630 | 630 | "twill::$this->moduleName.form", |
631 | 631 | "twill::layouts.form", |
632 | - ])->first(function ($view) { |
|
632 | + ])->first(function($view) { |
|
633 | 633 | return View::exists($view); |
634 | 634 | }); |
635 | 635 | |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | $query = $this->request->input('q'); |
892 | 892 | $tags = $this->repository->getTags($query); |
893 | 893 | |
894 | - return Response::json(['items' => $tags->map(function ($tag) { |
|
894 | + return Response::json(['items' => $tags->map(function($tag) { |
|
895 | 895 | return $tag->name; |
896 | 896 | })], 200); |
897 | 897 | } |
@@ -979,8 +979,8 @@ discard block |
||
979 | 979 | protected function getIndexTableData($items) |
980 | 980 | { |
981 | 981 | $translated = $this->moduleHas('translations'); |
982 | - return $items->map(function ($item) use ($translated) { |
|
983 | - $columnsData = Collection::make($this->indexColumns)->mapWithKeys(function ($column) use ($item) { |
|
982 | + return $items->map(function($item) use ($translated) { |
|
983 | + $columnsData = Collection::make($this->indexColumns)->mapWithKeys(function($column) use ($item) { |
|
984 | 984 | return $this->getItemColumnData($item, $column); |
985 | 985 | })->toArray(); |
986 | 986 | |
@@ -1240,7 +1240,7 @@ discard block |
||
1240 | 1240 | 'feature', |
1241 | 1241 | 'bulkFeature', |
1242 | 1242 | 'bulkDelete', |
1243 | - ])->mapWithKeys(function ($endpoint) { |
|
1243 | + ])->mapWithKeys(function($endpoint) { |
|
1244 | 1244 | return [ |
1245 | 1245 | $endpoint . 'Url' => $this->getIndexOption($endpoint) ? moduleRoute( |
1246 | 1246 | $this->moduleName, |
@@ -1258,7 +1258,7 @@ discard block |
||
1258 | 1258 | */ |
1259 | 1259 | protected function getIndexOption($option) |
1260 | 1260 | { |
1261 | - return once(function () use ($option) { |
|
1261 | + return once(function() use ($option) { |
|
1262 | 1262 | $customOptionNamesMapping = [ |
1263 | 1263 | 'store' => 'create', |
1264 | 1264 | ]; |
@@ -1315,8 +1315,8 @@ discard block |
||
1315 | 1315 | { |
1316 | 1316 | $withImage = $this->moduleHas('medias'); |
1317 | 1317 | |
1318 | - return $items->map(function ($item) use ($withImage) { |
|
1319 | - $columnsData = Collection::make($this->browserColumns)->mapWithKeys(function ($column) use ($item) { |
|
1318 | + return $items->map(function($item) use ($withImage) { |
|
1319 | + $columnsData = Collection::make($this->browserColumns)->mapWithKeys(function($column) use ($item) { |
|
1320 | 1320 | return $this->getItemColumnData($item, $column); |
1321 | 1321 | })->toArray(); |
1322 | 1322 | |
@@ -1382,7 +1382,7 @@ discard block |
||
1382 | 1382 | $fieldSplitted = explode('|', $field); |
1383 | 1383 | if (count($fieldSplitted) > 1) { |
1384 | 1384 | $requestValue = $requestFilters[$key]; |
1385 | - Collection::make($fieldSplitted)->each(function ($scopeKey) use (&$scope, $requestValue) { |
|
1385 | + Collection::make($fieldSplitted)->each(function($scopeKey) use (&$scope, $requestValue) { |
|
1386 | 1386 | $scope[$scopeKey] = $requestValue; |
1387 | 1387 | }); |
1388 | 1388 | } else { |
@@ -1558,11 +1558,11 @@ discard block |
||
1558 | 1558 | */ |
1559 | 1559 | protected function validateFormRequest() |
1560 | 1560 | { |
1561 | - $unauthorizedFields = Collection::make($this->fieldsPermissions)->filter(function ($permission, $field) { |
|
1561 | + $unauthorizedFields = Collection::make($this->fieldsPermissions)->filter(function($permission, $field) { |
|
1562 | 1562 | return Auth::guard('twill_users')->user()->cannot($permission); |
1563 | 1563 | })->keys(); |
1564 | 1564 | |
1565 | - $unauthorizedFields->each(function ($field) { |
|
1565 | + $unauthorizedFields->each(function($field) { |
|
1566 | 1566 | $this->request->offsetUnset($field); |
1567 | 1567 | }); |
1568 | 1568 | |
@@ -1614,7 +1614,7 @@ discard block |
||
1614 | 1614 | $singularName = Str::singular($name); |
1615 | 1615 | $modelClass = config('twill.namespace') . '\\Models\\' . Str::studly($singularName); |
1616 | 1616 | |
1617 | - if(!class_exists($modelClass)) { |
|
1617 | + if (!class_exists($modelClass)) { |
|
1618 | 1618 | $modelClass = $this->getCapsuleByModule($name)['model']; |
1619 | 1619 | } |
1620 | 1620 | |
@@ -1860,7 +1860,7 @@ discard block |
||
1860 | 1860 | */ |
1861 | 1861 | public function getRepeaterList() |
1862 | 1862 | { |
1863 | - return app(BlockCollection::class)->getRepeaterList()->mapWithKeys(function ($repeater) { |
|
1863 | + return app(BlockCollection::class)->getRepeaterList()->mapWithKeys(function($repeater) { |
|
1864 | 1864 | return [$repeater['name'] => $repeater]; |
1865 | 1865 | }); |
1866 | 1866 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | 'hasPosition', |
208 | 208 | 'hasRevisions', |
209 | 209 | 'hasNesting', |
210 | - ])->filter(function ($enabled) { |
|
210 | + ])->filter(function($enabled) { |
|
211 | 211 | return $enabled; |
212 | 212 | }); |
213 | 213 | |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | $start = "{$delimiters[0]}{$key}{$delimiters[1]}"; |
832 | 832 | $end = "{$delimiters[0]}\/{$key}{$delimiters[1]}"; |
833 | 833 | |
834 | - if ((bool)$value) { |
|
834 | + if ((bool) $value) { |
|
835 | 835 | // replace delimiters only |
836 | 836 | $stub = preg_replace("/$start/", '', $stub); |
837 | 837 | $stub = preg_replace("/$end/", '', $stub); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | public function registerCapsules() |
46 | 46 | { |
47 | - $this->manager->getCapsuleList()->map(function ($capsule) { |
|
47 | + $this->manager->getCapsuleList()->map(function($capsule) { |
|
48 | 48 | $this->registerCapsule($capsule); |
49 | 49 | }); |
50 | 50 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | if (!self::$capsulesBootstrapped) { |
60 | 60 | $this->getCapsuleList() |
61 | 61 | ->where('enabled', true) |
62 | - ->each(function ($capsule) { |
|
62 | + ->each(function($capsule) { |
|
63 | 63 | $this->bootstrapCapsule($capsule); |
64 | 64 | }); |
65 | 65 | self::$capsulesBootstrapped = true; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | public function registerViewPaths() |
76 | 76 | { |
77 | 77 | if (file_exists(config('twill.capsules.path'))) { |
78 | - $callback = function ($view) { |
|
78 | + $callback = function($view) { |
|
79 | 79 | $view->addLocation(config('twill.capsules.path')); |
80 | 80 | }; |
81 | 81 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | if (!config('twill.capsules.loaded')) { |
24 | 24 | $list = $list |
25 | 25 | ->where('enabled', true) |
26 | - ->map(function ($capsule) use ($path) { |
|
26 | + ->map(function($capsule) use ($path) { |
|
27 | 27 | return $this->makeCapsule($capsule, $path); |
28 | 28 | }); |
29 | 29 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public function getCapsuleByModule($module) |
42 | 42 | { |
43 | 43 | return $this->getCapsuleList() |
44 | - ->filter(function ($capsule) use ($module) { |
|
44 | + ->filter(function($capsule) use ($module) { |
|
45 | 45 | return Str::lower($capsule['plural']) == Str::lower($module); |
46 | 46 | }) |
47 | 47 | ->first(); |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | { |
265 | 265 | $twillSeeder = app(CapsuleSeeder::class); |
266 | 266 | |
267 | - $this->getCapsuleList()->each(function ($capsule) use ( |
|
267 | + $this->getCapsuleList()->each(function($capsule) use ( |
|
268 | 268 | $twillSeeder, |
269 | 269 | $illuminateSeeder |
270 | 270 | ) { |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | return; |
376 | 376 | } |
377 | 377 | |
378 | - collect($files)->each(function ($file) { |
|
378 | + collect($files)->each(function($file) { |
|
379 | 379 | if (file_exists($file)) { |
380 | 380 | require_once $file; |
381 | 381 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | $this->modelName = $this->locateModel($this->argument('modelName')); |
100 | 100 | |
101 | - if (! $this->modelName) { |
|
101 | + if (!$this->modelName) { |
|
102 | 102 | $this->error("Model `{$this->argument('modelName')}` was not found`"); |
103 | 103 | |
104 | 104 | return 1; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | $mediasParams = app($this->modelName)->mediasParams; |
110 | 110 | |
111 | - if (! isset($mediasParams[$this->roleName])) { |
|
111 | + if (!isset($mediasParams[$this->roleName])) { |
|
112 | 112 | $this->error("Role `{$this->roleName}` was not found`"); |
113 | 113 | |
114 | 114 | return 1; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function byKey($key, $section = null) |
36 | 36 | { |
37 | - $settingQuery = $this->model->when($section, function ($query) use ($section) { |
|
37 | + $settingQuery = $this->model->when($section, function($query) use ($section) { |
|
38 | 38 | $query->where('section', $section); |
39 | 39 | })->where('key', $key); |
40 | 40 | |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function getFormFields($section = null) |
53 | 53 | { |
54 | - $settings = $this->model->when($section, function ($query) use ($section) { |
|
54 | + $settings = $this->model->when($section, function($query) use ($section) { |
|
55 | 55 | $query->where('section', $section); |
56 | 56 | })->with('translations', 'medias')->get(); |
57 | 57 | |
58 | 58 | |
59 | 59 | if (config('twill.media_library.translated_form_fields', false)) { |
60 | - $medias = $settings->reduce(function ($carry, $setting) { |
|
60 | + $medias = $settings->reduce(function($carry, $setting) { |
|
61 | 61 | foreach (getLocales() as $locale) { |
62 | 62 | if (!empty(parent::getFormFields($setting)['medias'][$locale]) && !empty(parent::getFormFields($setting)['medias'][$locale][$setting->key])) |
63 | 63 | { |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | return $carry; |
68 | 68 | }); |
69 | 69 | } else { |
70 | - $medias = $settings->mapWithKeys(function ($setting) { |
|
70 | + $medias = $settings->mapWithKeys(function($setting) { |
|
71 | 71 | return [$setting->key => parent::getFormFields($setting)['medias'][$setting->key] ?? null]; |
72 | 72 | })->filter()->toArray(); |
73 | 73 | } |
74 | 74 | |
75 | - return $settings->mapWithKeys(function ($setting) { |
|
75 | + return $settings->mapWithKeys(function($setting) { |
|
76 | 76 | $settingValue = []; |
77 | 77 | |
78 | 78 | foreach ($setting->translations as $translation) { |
@@ -123,13 +123,13 @@ discard block |
||
123 | 123 | |
124 | 124 | if (config('twill.media_library.translated_form_fields', false)) { |
125 | 125 | foreach (getLocales() as $locale) { |
126 | - $medias["{$role}[{$locale}]"] = Collection::make($settingsFields['medias'][$role][$locale])->map(function ($media) { |
|
126 | + $medias["{$role}[{$locale}]"] = Collection::make($settingsFields['medias'][$role][$locale])->map(function($media) { |
|
127 | 127 | return json_decode($media, true); |
128 | 128 | })->filter()->toArray(); |
129 | 129 | } |
130 | 130 | } else { |
131 | - $medias = [ |
|
132 | - $role => Collection::make($settingsFields['medias'][$role])->map(function ($media) { |
|
131 | + $medias = [ |
|
132 | + $role => Collection::make($settingsFields['medias'][$role])->map(function($media) { |
|
133 | 133 | return json_decode($media, true); |
134 | 134 | })->values()->filter()->toArray(), |
135 | 135 | ]; |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | |
33 | 33 | $submittedLanguages = Collection::make($fields['languages'] ?? []); |
34 | 34 | |
35 | - $atLeastOneLanguageIsPublished = $submittedLanguages->contains(function ($language) { |
|
35 | + $atLeastOneLanguageIsPublished = $submittedLanguages->contains(function($language) { |
|
36 | 36 | return $language['published']; |
37 | 37 | }); |
38 | 38 | |
39 | 39 | foreach ($locales as $index => $locale) { |
40 | - $submittedLanguage = Arr::first($submittedLanguages->filter(function ($lang) use ($locale) { |
|
40 | + $submittedLanguage = Arr::first($submittedLanguages->filter(function($lang) use ($locale) { |
|
41 | 41 | return $lang['value'] == $locale; |
42 | 42 | })); |
43 | 43 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | $fields[$locale] = [ |
49 | 49 | 'active' => $activeField, |
50 | - ] + $attributes->mapWithKeys(function ($attribute) use (&$fields, $locale, $localesCount, $index) { |
|
50 | + ] + $attributes->mapWithKeys(function($attribute) use (&$fields, $locale, $localesCount, $index) { |
|
51 | 51 | $attributeValue = $fields[$attribute] ?? null; |
52 | 52 | |
53 | 53 | // if we are at the last locale, |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | { |
107 | 107 | if ($this->model->isTranslatable()) { |
108 | 108 | $attributes = $this->model->translatedAttributes; |
109 | - $query->whereHas('translations', function ($q) use ($scopes, $attributes) { |
|
109 | + $query->whereHas('translations', function($q) use ($scopes, $attributes) { |
|
110 | 110 | foreach ($attributes as $attribute) { |
111 | 111 | if (isset($scopes[$attribute]) && is_string($scopes[$attribute])) { |
112 | 112 | $q->where($attribute, $this->getLikeOperator(), '%' . $scopes[$attribute] . '%'); |