@@ -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,15 +45,15 @@ 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 | - $medias = $settings->mapWithKeys(function ($setting) { |
|
| 52 | + $medias = $settings->mapWithKeys(function($setting) { |
|
| 53 | 53 | return [$setting->key => parent::getFormFields($setting)['medias'][$setting->key] ?? null]; |
| 54 | 54 | })->filter()->toArray(); |
| 55 | 55 | |
| 56 | - return $settings->mapWithKeys(function ($setting) { |
|
| 56 | + return $settings->mapWithKeys(function($setting) { |
|
| 57 | 57 | $settingValue = []; |
| 58 | 58 | |
| 59 | 59 | foreach ($setting->translations as $translation) { |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $this->updateOrCreate($section + ['key' => $role], $section + [ |
| 102 | 102 | 'key' => $role, |
| 103 | 103 | 'medias' => [ |
| 104 | - $role => Collection::make($settingsFields['medias'][$role])->map(function ($media) { |
|
| 104 | + $role => Collection::make($settingsFields['medias'][$role])->map(function($media) { |
|
| 105 | 105 | return json_decode($media, true); |
| 106 | 106 | })->values()->filter()->toArray(), |
| 107 | 107 | ], |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | */ |
| 63 | 63 | public function filter($query, array $scopes = []) |
| 64 | 64 | { |
| 65 | - $query->when(isset($scopes['role']), function ($query) use ($scopes) { |
|
| 65 | + $query->when(isset($scopes['role']), function($query) use ($scopes) { |
|
| 66 | 66 | $query->where('role', $scopes['role']); |
| 67 | 67 | }); |
| 68 | 68 | $query->where('role', '<>', 'SUPERADMIN'); |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | $relationRepository = $this->getModelRepository($relation, $model); |
| 16 | 16 | |
| 17 | 17 | if (!$keepExisting) { |
| 18 | - $object->$relation()->each(function ($repeaterElement) { |
|
| 18 | + $object->$relation()->each(function($repeaterElement) { |
|
| 19 | 19 | $repeaterElement->forceDelete(); |
| 20 | 20 | }); |
| 21 | 21 | } |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | if (isset($relatedItemFormFields['medias'])) { |
| 114 | 114 | if (config('twill.media_library.translated_form_fields', false)) { |
| 115 | - Collection::make($relatedItemFormFields['medias'])->each(function ($rolesWithMedias, $locale) use (&$repeatersMedias, $relation, $relationItem) { |
|
| 116 | - $repeatersMedias[] = Collection::make($rolesWithMedias)->mapWithKeys(function ($medias, $role) use ($locale, $relation, $relationItem) { |
|
| 115 | + Collection::make($relatedItemFormFields['medias'])->each(function($rolesWithMedias, $locale) use (&$repeatersMedias, $relation, $relationItem) { |
|
| 116 | + $repeatersMedias[] = Collection::make($rolesWithMedias)->mapWithKeys(function($medias, $role) use ($locale, $relation, $relationItem) { |
|
| 117 | 117 | return [ |
| 118 | 118 | "blocks[$relation-$relationItem->id][$role][$locale]" => $medias, |
| 119 | 119 | ]; |
@@ -127,8 +127,8 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (isset($relatedItemFormFields['files'])) { |
| 130 | - Collection::make($relatedItemFormFields['files'])->each(function ($rolesWithFiles, $locale) use (&$repeatersFiles, $relation, $relationItem) { |
|
| 131 | - $repeatersFiles[] = Collection::make($rolesWithFiles)->mapWithKeys(function ($files, $role) use ($locale, $relation, $relationItem) { |
|
| 130 | + Collection::make($relatedItemFormFields['files'])->each(function($rolesWithFiles, $locale) use (&$repeatersFiles, $relation, $relationItem) { |
|
| 131 | + $repeatersFiles[] = Collection::make($rolesWithFiles)->mapWithKeys(function($files, $role) use ($locale, $relation, $relationItem) { |
|
| 132 | 132 | return [ |
| 133 | 133 | "blocks[$relation-$relationItem->id][$role][$locale]" => $files, |
| 134 | 134 | ]; |
@@ -23,12 +23,12 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | $submittedLanguages = Collection::make($fields['languages'] ?? []); |
| 25 | 25 | |
| 26 | - $atLeastOneLanguageIsPublished = $submittedLanguages->contains(function ($language) { |
|
| 26 | + $atLeastOneLanguageIsPublished = $submittedLanguages->contains(function($language) { |
|
| 27 | 27 | return $language['published']; |
| 28 | 28 | }); |
| 29 | 29 | |
| 30 | 30 | foreach ($locales as $index => $locale) { |
| 31 | - $submittedLanguage = Arr::first($submittedLanguages->filter(function ($lang) use ($locale) { |
|
| 31 | + $submittedLanguage = Arr::first($submittedLanguages->filter(function($lang) use ($locale) { |
|
| 32 | 32 | return $lang['value'] == $locale; |
| 33 | 33 | })); |
| 34 | 34 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | $fields[$locale] = [ |
| 40 | 40 | 'active' => $activeField, |
| 41 | - ] + $attributes->mapWithKeys(function ($attribute) use (&$fields, $locale, $localesCount, $index) { |
|
| 41 | + ] + $attributes->mapWithKeys(function($attribute) use (&$fields, $locale, $localesCount, $index) { |
|
| 42 | 42 | $attributeValue = $fields[$attribute] ?? null; |
| 43 | 43 | |
| 44 | 44 | // if we are at the last locale, |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | { |
| 80 | 80 | if (property_exists($this->model, 'translatedAttributes')) { |
| 81 | 81 | $attributes = $this->model->translatedAttributes; |
| 82 | - $query->whereHas('translations', function ($q) use ($scopes, $attributes) { |
|
| 82 | + $query->whereHas('translations', function($q) use ($scopes, $attributes) { |
|
| 83 | 83 | foreach ($attributes as $attribute) { |
| 84 | 84 | if (isset($scopes[$attribute]) && is_string($scopes[$attribute])) { |
| 85 | 85 | $q->where($attribute, 'like', '%' . $scopes[$attribute] . '%'); |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | $blockRepository->bulkDelete($object->blocks()->pluck('id')->toArray()); |
| 72 | 72 | |
| 73 | - $this->getBlocks($object, $fields)->each(function ($block) use ($object, $blockRepository) { |
|
| 73 | + $this->getBlocks($object, $fields)->each(function($block) use ($object, $blockRepository) { |
|
| 74 | 74 | |
| 75 | 75 | $blockCreated = $blockRepository->create($block); |
| 76 | 76 | |
| 77 | - $block['blocks']->each(function ($childBlock) use ($blockCreated, $blockRepository) { |
|
| 77 | + $block['blocks']->each(function($childBlock) use ($blockCreated, $blockRepository) { |
|
| 78 | 78 | $childBlock['parent_id'] = $blockCreated->id; |
| 79 | 79 | $blockRepository->create($childBlock); |
| 80 | 80 | }); |
@@ -173,9 +173,9 @@ discard block |
||
| 173 | 173 | ]; |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - $fields['blocksFields'][] = Collection::make($block['content'])->filter(function ($value, $key) { |
|
| 176 | + $fields['blocksFields'][] = Collection::make($block['content'])->filter(function($value, $key) { |
|
| 177 | 177 | return $key !== "browsers"; |
| 178 | - })->map(function ($value, $key) use ($block) { |
|
| 178 | + })->map(function($value, $key) use ($block) { |
|
| 179 | 179 | return [ |
| 180 | 180 | 'name' => "blocks[$block->id][$key]", |
| 181 | 181 | 'value' => $value, |
@@ -188,15 +188,15 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | if ($medias) { |
| 190 | 190 | if (config('twill.media_library.translated_form_fields', false)) { |
| 191 | - $fields['blocksMedias'][] = Collection::make($medias)->mapWithKeys(function ($mediasByLocale, $locale) use ($block) { |
|
| 192 | - return Collection::make($mediasByLocale)->mapWithKeys(function ($value, $key) use ($block, $locale) { |
|
| 191 | + $fields['blocksMedias'][] = Collection::make($medias)->mapWithKeys(function($mediasByLocale, $locale) use ($block) { |
|
| 192 | + return Collection::make($mediasByLocale)->mapWithKeys(function($value, $key) use ($block, $locale) { |
|
| 193 | 193 | return [ |
| 194 | 194 | "blocks[$block->id][$key][$locale]" => $value, |
| 195 | 195 | ]; |
| 196 | 196 | }); |
| 197 | 197 | })->filter()->toArray(); |
| 198 | 198 | } else { |
| 199 | - $fields['blocksMedias'][] = Collection::make($medias)->mapWithKeys(function ($value, $key) use ($block) { |
|
| 199 | + $fields['blocksMedias'][] = Collection::make($medias)->mapWithKeys(function($value, $key) use ($block) { |
|
| 200 | 200 | return [ |
| 201 | 201 | "blocks[$block->id][$key]" => $value, |
| 202 | 202 | ]; |
@@ -207,8 +207,8 @@ discard block |
||
| 207 | 207 | $files = $blockFormFields['files']; |
| 208 | 208 | |
| 209 | 209 | if ($files) { |
| 210 | - Collection::make($files)->each(function ($rolesWithFiles, $locale) use (&$fields, $block) { |
|
| 211 | - $fields['blocksFiles'][] = Collection::make($rolesWithFiles)->mapWithKeys(function ($files, $role) use ($locale, $block) { |
|
| 210 | + Collection::make($files)->each(function($rolesWithFiles, $locale) use (&$fields, $block) { |
|
| 211 | + $fields['blocksFiles'][] = Collection::make($rolesWithFiles)->mapWithKeys(function($files, $role) use ($locale, $block) { |
|
| 212 | 212 | return [ |
| 213 | 213 | "blocks[$block->id][$role][$locale]" => $files, |
| 214 | 214 | ]; |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | protected function getBlockBrowsers($block) |
| 249 | 249 | { |
| 250 | - return Collection::make($block['content']['browsers'])->mapWithKeys(function ($ids, $relation) use ($block) { |
|
| 250 | + return Collection::make($block['content']['browsers'])->mapWithKeys(function($ids, $relation) use ($block) { |
|
| 251 | 251 | $relationRepository = $this->getModelRepository($relation); |
| 252 | 252 | $relatedItems = $relationRepository->get([], ['id' => $ids], [], -1); |
| 253 | 253 | $sortedRelatedItems = array_flip($ids); |
@@ -256,9 +256,9 @@ discard block |
||
| 256 | 256 | $sortedRelatedItems[$item->id] = $item; |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - $items = Collection::make(array_values($sortedRelatedItems))->filter(function ($value) { |
|
| 259 | + $items = Collection::make(array_values($sortedRelatedItems))->filter(function($value) { |
|
| 260 | 260 | return is_object($value); |
| 261 | - })->map(function ($relatedElement) use ($relation) { |
|
| 261 | + })->map(function($relatedElement) use ($relation) { |
|
| 262 | 262 | return [ |
| 263 | 263 | 'id' => $relatedElement->id, |
| 264 | 264 | 'name' => $relatedElement->titleInBrowser ?? $relatedElement->title, |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | $mediasCollection = Collection::make(); |
| 24 | 24 | $mediasFromFields = $this->getMedias($fields); |
| 25 | 25 | |
| 26 | - $mediasFromFields->each(function ($media) use ($object, $mediasCollection) { |
|
| 26 | + $mediasFromFields->each(function($media) use ($object, $mediasCollection) { |
|
| 27 | 27 | $newMedia = Media::withTrashed()->find(is_array($media['id']) ? Arr::first($media['id']) : $media['id']); |
| 28 | 28 | $pivot = $newMedia->newPivot($object, Arr::except($media, ['id']), 'mediables', true); |
| 29 | 29 | $newMedia->setRelation('pivot', $pivot); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | $object->medias()->sync([]); |
| 50 | 50 | |
| 51 | - $this->getMedias($fields)->each(function ($media) use ($object) { |
|
| 51 | + $this->getMedias($fields)->each(function($media) use ($object) { |
|
| 52 | 52 | $object->medias()->attach($media['id'], Arr::except($media, ['id'])); |
| 53 | 53 | }); |
| 54 | 54 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | if (in_array($role, array_keys($this->model->mediasParams ?? [])) |
| 78 | 78 | || in_array($role, array_keys(config('twill.block_editor.crops', []))) |
| 79 | 79 | || in_array($role, array_keys(config('twill.settings.crops', [])))) { |
| 80 | - Collection::make($mediasForRole)->each(function ($media) use (&$medias, $role, $locale) { |
|
| 80 | + Collection::make($mediasForRole)->each(function($media) use (&$medias, $role, $locale) { |
|
| 81 | 81 | $customMetadatas = $media['metadatas']['custom'] ?? []; |
| 82 | 82 | if (isset($media['crops']) && !empty($media['crops'])) { |
| 83 | 83 | foreach ($media['crops'] as $cropName => $cropData) { |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | if (!$item && config('translatable.use_property_fallback', false)) { |
| 81 | - $item = (clone $query)->orWhere(function ($query) { |
|
| 81 | + $item = (clone $query)->orWhere(function($query) { |
|
| 82 | 82 | return $query->withActiveTranslations(config('translatable.fallback_locale')); |
| 83 | 83 | })->forFallbackLocaleSlug($slug)->first(); |
| 84 | 84 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | $filesCollection = Collection::make(); |
| 24 | 24 | $filesFromFields = $this->getFiles($fields); |
| 25 | 25 | |
| 26 | - $filesFromFields->each(function ($file) use ($object, $filesCollection) { |
|
| 26 | + $filesFromFields->each(function($file) use ($object, $filesCollection) { |
|
| 27 | 27 | $newFile = File::withTrashed()->find($file['id']); |
| 28 | 28 | $pivot = $newFile->newPivot($object, Arr::except($file, ['id']), 'fileables', true); |
| 29 | 29 | $newFile->setRelation('pivot', $pivot); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | $object->files()->sync([]); |
| 50 | 50 | |
| 51 | - $this->getFiles($fields)->each(function ($file) use ($object) { |
|
| 51 | + $this->getFiles($fields)->each(function($file) use ($object) { |
|
| 52 | 52 | $object->files()->attach($file['id'], Arr::except($file, ['id'])); |
| 53 | 53 | }); |
| 54 | 54 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | if (in_array($role, $this->model->filesParams ?? []) |
| 75 | 75 | || in_array($role, config('twill.block_editor.files', []))) { |
| 76 | 76 | |
| 77 | - Collection::make($filesForRole)->each(function ($file) use (&$files, $role, $locale) { |
|
| 77 | + Collection::make($filesForRole)->each(function($file) use (&$files, $role, $locale) { |
|
| 78 | 78 | $files->push([ |
| 79 | 79 | 'id' => $file['id'], |
| 80 | 80 | 'role' => $role, |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | if ($object->has('files')) { |
| 100 | 100 | foreach ($object->files->groupBy('pivot.role') as $role => $filesByRole) { |
| 101 | 101 | foreach ($filesByRole->groupBy('pivot.locale') as $locale => $filesByLocale) { |
| 102 | - $fields['files'][$locale][$role] = $filesByLocale->map(function ($file) { |
|
| 102 | + $fields['files'][$locale][$role] = $filesByLocale->map(function($file) { |
|
| 103 | 103 | return $file->toCmsArray(); |
| 104 | 104 | }); |
| 105 | 105 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | foreach ($fields as $field) { |
| 180 | 180 | if (in_array($field, $translatedAttributes)) { |
| 181 | - $query->orWhereHas('translations', function ($q) use ($field, $search) { |
|
| 181 | + $query->orWhereHas('translations', function($q) use ($field, $search) { |
|
| 182 | 182 | $q->where($field, $this->getLikeOperator(), "%{$search}%"); |
| 183 | 183 | }); |
| 184 | 184 | } else { |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | public function create($fields) |
| 207 | 207 | { |
| 208 | - return DB::transaction(function () use ($fields) { |
|
| 208 | + return DB::transaction(function() use ($fields) { |
|
| 209 | 209 | $original_fields = $fields; |
| 210 | 210 | |
| 211 | 211 | $fields = $this->prepareFieldsBeforeCreate($fields); |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | */ |
| 261 | 261 | public function update($id, $fields) |
| 262 | 262 | { |
| 263 | - DB::transaction(function () use ($id, $fields) { |
|
| 263 | + DB::transaction(function() use ($id, $fields) { |
|
| 264 | 264 | $object = $this->model->findOrFail($id); |
| 265 | 265 | |
| 266 | 266 | $this->beforeSave($object, $fields); |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | */ |
| 284 | 284 | public function updateBasic($id, $values, $scopes = []) |
| 285 | 285 | { |
| 286 | - return DB::transaction(function () use ($id, $values, $scopes) { |
|
| 286 | + return DB::transaction(function() use ($id, $values, $scopes) { |
|
| 287 | 287 | // apply scopes if no id provided |
| 288 | 288 | if (is_null($id)) { |
| 289 | 289 | $query = $this->model->query(); |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | |
| 295 | 295 | $query->update($values); |
| 296 | 296 | |
| 297 | - $query->get()->each(function ($object) use ($values) { |
|
| 297 | + $query->get()->each(function($object) use ($values) { |
|
| 298 | 298 | $this->afterUpdateBasic($object, $values); |
| 299 | 299 | }); |
| 300 | 300 | |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | $query = $this->model->whereIn('id', $id); |
| 307 | 307 | $query->update($values); |
| 308 | 308 | |
| 309 | - $query->get()->each(function ($object) use ($values) { |
|
| 309 | + $query->get()->each(function($object) use ($values) { |
|
| 310 | 310 | $this->afterUpdateBasic($object, $values); |
| 311 | 311 | }); |
| 312 | 312 | |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | */ |
| 330 | 330 | public function setNewOrder($ids) |
| 331 | 331 | { |
| 332 | - DB::transaction(function () use ($ids) { |
|
| 332 | + DB::transaction(function() use ($ids) { |
|
| 333 | 333 | $this->model->setNewOrder($ids); |
| 334 | 334 | }, 3); |
| 335 | 335 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | */ |
| 341 | 341 | public function delete($id) |
| 342 | 342 | { |
| 343 | - return DB::transaction(function () use ($id) { |
|
| 343 | + return DB::transaction(function() use ($id) { |
|
| 344 | 344 | if (($object = $this->model->find($id)) === null) { |
| 345 | 345 | return false; |
| 346 | 346 | } |
@@ -360,9 +360,9 @@ discard block |
||
| 360 | 360 | */ |
| 361 | 361 | public function bulkDelete($ids) |
| 362 | 362 | { |
| 363 | - return DB::transaction(function () use ($ids) { |
|
| 363 | + return DB::transaction(function() use ($ids) { |
|
| 364 | 364 | try { |
| 365 | - Collection::make($ids)->each(function ($id) { |
|
| 365 | + Collection::make($ids)->each(function($id) { |
|
| 366 | 366 | $this->delete($id); |
| 367 | 367 | }); |
| 368 | 368 | } catch (\Exception $e) { |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | */ |
| 381 | 381 | public function restore($id) |
| 382 | 382 | { |
| 383 | - return DB::transaction(function () use ($id) { |
|
| 383 | + return DB::transaction(function() use ($id) { |
|
| 384 | 384 | if (($object = $this->model->withTrashed()->find($id)) != null) { |
| 385 | 385 | $object->restore(); |
| 386 | 386 | $this->afterRestore($object); |
@@ -397,14 +397,14 @@ discard block |
||
| 397 | 397 | */ |
| 398 | 398 | public function bulkRestore($ids) |
| 399 | 399 | { |
| 400 | - return DB::transaction(function () use ($ids) { |
|
| 400 | + return DB::transaction(function() use ($ids) { |
|
| 401 | 401 | try { |
| 402 | 402 | $query = $this->model->withTrashed()->whereIn('id', $ids); |
| 403 | 403 | $objects = $query->get(); |
| 404 | 404 | |
| 405 | 405 | $query->restore(); |
| 406 | 406 | |
| 407 | - $objects->each(function ($object) { |
|
| 407 | + $objects->each(function($object) { |
|
| 408 | 408 | $this->afterRestore($object); |
| 409 | 409 | }); |
| 410 | 410 | } catch (\Exception $e) { |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | */ |
| 665 | 665 | public function getFormFieldsForBrowser($object, $relation, $routePrefix = null, $titleKey = 'title', $moduleName = null) |
| 666 | 666 | { |
| 667 | - return $object->$relation->map(function ($relatedElement) use ($titleKey, $routePrefix, $relation, $moduleName) { |
|
| 667 | + return $object->$relation->map(function($relatedElement) use ($titleKey, $routePrefix, $relation, $moduleName) { |
|
| 668 | 668 | return [ |
| 669 | 669 | 'id' => $relatedElement->id, |
| 670 | 670 | 'name' => $relatedElement->titleInBrowser ?? $relatedElement->$titleKey, |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | */ |
| 684 | 684 | public function getFormFieldsForRelatedBrowser($object, $relation) |
| 685 | 685 | { |
| 686 | - return $object->getRelated($relation)->map(function ($relatedElement) { |
|
| 686 | + return $object->getRelated($relation)->map(function($relatedElement) { |
|
| 687 | 687 | return ($relatedElement != null) ? [ |
| 688 | 688 | 'id' => $relatedElement->id, |
| 689 | 689 | 'name' => $relatedElement->titleInBrowser ?? $relatedElement->title, |
@@ -693,7 +693,7 @@ discard block |
||
| 693 | 693 | ]) + (classHasTrait($relatedElement, HasMedias::class) ? [ |
| 694 | 694 | 'thumbnail' => $relatedElement->defaultCmsImage(['w' => 100, 'h' => 100]), |
| 695 | 695 | ] : []) : []; |
| 696 | - })->reject(function ($item) { |
|
| 696 | + })->reject(function($item) { |
|
| 697 | 697 | return empty($item); |
| 698 | 698 | })->values()->toArray(); |
| 699 | 699 | } |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | { |
| 789 | 789 | if (isset($scopes[$scopeField])) { |
| 790 | 790 | $id = $scopes[$scopeField]; |
| 791 | - $query->whereHas($scopeRelation, function ($query) use ($id, $scopeField) { |
|
| 791 | + $query->whereHas($scopeRelation, function($query) use ($id, $scopeField) { |
|
| 792 | 792 | $query->where($scopeField, $id); |
| 793 | 793 | }); |
| 794 | 794 | unset($scopes[$scopeField]); |
@@ -819,7 +819,7 @@ discard block |
||
| 819 | 819 | { |
| 820 | 820 | |
| 821 | 821 | if (isset($scopes[$scopeField]) && is_string($scopes[$scopeField])) { |
| 822 | - $query->where(function ($query) use (&$scopes, $scopeField, $orFields) { |
|
| 822 | + $query->where(function($query) use (&$scopes, $scopeField, $orFields) { |
|
| 823 | 823 | foreach ($orFields as $field) { |
| 824 | 824 | $query->orWhere($field, $this->getLikeOperator(), '%' . $scopes[$scopeField] . '%'); |
| 825 | 825 | unset($scopes[$field]); |