@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | private function findMedia($role, $crop = "default") |
| 44 | 44 | { |
| 45 | - $media = $this->medias->first(function ($media) use ($role, $crop) { |
|
| 45 | + $media = $this->medias->first(function($media) use ($role, $crop) { |
|
| 46 | 46 | if (config('twill.media_library.translated_form_fields', false)) { |
| 47 | 47 | $localeScope = $media->pivot->locale === app()->getLocale(); |
| 48 | 48 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | }); |
| 52 | 52 | |
| 53 | 53 | if (!$media && config('twill.media_library.translated_form_fields', false)) { |
| 54 | - $media = $this->medias->first(function ($media) use ($role, $crop) { |
|
| 54 | + $media = $this->medias->first(function($media) use ($role, $crop) { |
|
| 55 | 55 | return $media->pivot->role === $role && $media->pivot->crop === $crop; |
| 56 | 56 | }); |
| 57 | 57 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | public function images($role, $crop = "default", $params = []) |
| 122 | 122 | { |
| 123 | - $medias = $this->medias->filter(function ($media) use ($role, $crop) { |
|
| 123 | + $medias = $this->medias->filter(function($media) use ($role, $crop) { |
|
| 124 | 124 | return $media->pivot->role === $role && $media->pivot->crop === $crop; |
| 125 | 125 | }); |
| 126 | 126 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function imagesWithCrops($role, $params = []) |
| 144 | 144 | { |
| 145 | - $medias = $this->medias->filter(function ($media) use ($role) { |
|
| 145 | + $medias = $this->medias->filter(function($media) use ($role) { |
|
| 146 | 146 | return $media->pivot->role === $role; |
| 147 | 147 | }); |
| 148 | 148 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | public function imagesAsArrays($role, $crop = "default", $params = []) |
| 197 | 197 | { |
| 198 | - $medias = $this->medias->filter(function ($media) use ($role, $crop) { |
|
| 198 | + $medias = $this->medias->filter(function($media) use ($role, $crop) { |
|
| 199 | 199 | return $media->pivot->role === $role && $media->pivot->crop === $crop; |
| 200 | 200 | }); |
| 201 | 201 | |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | public function imagesAsArraysWithCrops($role, $params = []) |
| 219 | 219 | { |
| 220 | - $medias = $this->medias->filter(function ($media) use ($role) { |
|
| 220 | + $medias = $this->medias->filter(function($media) use ($role) { |
|
| 221 | 221 | return $media->pivot->role === $role; |
| 222 | 222 | }); |
| 223 | 223 | |
@@ -241,12 +241,12 @@ discard block |
||
| 241 | 241 | public function imageAltText($role, $media = null) |
| 242 | 242 | { |
| 243 | 243 | if (!$media) { |
| 244 | - $media = $this->medias->first(function ($media) use ($role) { |
|
| 244 | + $media = $this->medias->first(function($media) use ($role) { |
|
| 245 | 245 | if (config('twill.media_library.translated_form_fields', false)) { |
| 246 | 246 | $localeScope = $media->pivot->locale === app()->getLocale(); |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - return $media->pivot->role === $role && ($localeScope ?? true);; |
|
| 249 | + return $media->pivot->role === $role && ($localeScope ?? true); ; |
|
| 250 | 250 | }); |
| 251 | 251 | } |
| 252 | 252 | |
@@ -267,12 +267,12 @@ discard block |
||
| 267 | 267 | public function imageCaption($role, $media = null) |
| 268 | 268 | { |
| 269 | 269 | if (!$media) { |
| 270 | - $media = $this->medias->first(function ($media) use ($role) { |
|
| 270 | + $media = $this->medias->first(function($media) use ($role) { |
|
| 271 | 271 | if (config('twill.media_library.translated_form_fields', false)) { |
| 272 | 272 | $localeScope = $media->pivot->locale === app()->getLocale(); |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - return $media->pivot->role === $role && ($localeScope ?? true);; |
|
| 275 | + return $media->pivot->role === $role && ($localeScope ?? true); ; |
|
| 276 | 276 | }); |
| 277 | 277 | } |
| 278 | 278 | |
@@ -293,12 +293,12 @@ discard block |
||
| 293 | 293 | public function imageVideo($role, $media = null) |
| 294 | 294 | { |
| 295 | 295 | if (!$media) { |
| 296 | - $media = $this->medias->first(function ($media) use ($role) { |
|
| 296 | + $media = $this->medias->first(function($media) use ($role) { |
|
| 297 | 297 | if (config('twill.media_library.translated_form_fields', false)) { |
| 298 | 298 | $localeScope = $media->pivot->locale === app()->getLocale(); |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - return $media->pivot->role === $role && ($localeScope ?? true);; |
|
| 301 | + return $media->pivot->role === $role && ($localeScope ?? true); ; |
|
| 302 | 302 | }); |
| 303 | 303 | } |
| 304 | 304 | |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | */ |
| 416 | 416 | public function imageObjects($role, $crop = "default") |
| 417 | 417 | { |
| 418 | - return $this->medias->filter(function ($media) use ($role, $crop) { |
|
| 418 | + return $this->medias->filter(function($media) use ($role, $crop) { |
|
| 419 | 419 | return $media->pivot->role === $role && $media->pivot->crop === $crop; |
| 420 | 420 | }); |
| 421 | 421 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function scopeMine($query) |
| 24 | 24 | { |
| 25 | - return $query->whereHas('revisions', function ($query) { |
|
| 25 | + return $query->whereHas('revisions', function($query) { |
|
| 26 | 26 | $query->where('user_id', auth('twill_users')->user()->id); |
| 27 | 27 | }); |
| 28 | 28 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function revisionsArray() |
| 36 | 36 | { |
| 37 | - return $this->revisions->map(function ($revision) { |
|
| 37 | + return $this->revisions->map(function($revision) { |
|
| 38 | 38 | return [ |
| 39 | 39 | 'id' => $revision->id, |
| 40 | 40 | 'author' => $revision->user->name ?? 'Unknown', |
@@ -26,11 +26,11 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | public function renderBlocks($renderChilds = true, $blockViewMappings = [], $data = []) |
| 28 | 28 | { |
| 29 | - return $this->blocks->where('parent_id', null)->map(function ($block) use ($blockViewMappings, $renderChilds, $data) { |
|
| 29 | + return $this->blocks->where('parent_id', null)->map(function($block) use ($blockViewMappings, $renderChilds, $data) { |
|
| 30 | 30 | if ($renderChilds) { |
| 31 | 31 | $childBlocks = $this->blocks->where('parent_id', $block->id); |
| 32 | 32 | |
| 33 | - $renderedChildViews = $childBlocks->map(function ($childBlock) use ($blockViewMappings, $data) { |
|
| 33 | + $renderedChildViews = $childBlocks->map(function($childBlock) use ($blockViewMappings, $data) { |
|
| 34 | 34 | $view = $this->getBlockView($childBlock->type, $blockViewMappings); |
| 35 | 35 | return view($view, $data)->with('block', $childBlock)->render(); |
| 36 | 36 | })->implode(''); |
@@ -11,15 +11,15 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | protected static function bootHasSlug() |
| 13 | 13 | { |
| 14 | - static::created(function ($model) { |
|
| 14 | + static::created(function($model) { |
|
| 15 | 15 | $model->setSlugs(); |
| 16 | 16 | }); |
| 17 | 17 | |
| 18 | - static::updated(function ($model) { |
|
| 18 | + static::updated(function($model) { |
|
| 19 | 19 | $model->setSlugs(); |
| 20 | 20 | }); |
| 21 | 21 | |
| 22 | - static::restored(function ($model) { |
|
| 22 | + static::restored(function($model) { |
|
| 23 | 23 | $model->setSlugs($restoring = true); |
| 24 | 24 | }); |
| 25 | 25 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function scopeForSlug($query, $slug) |
| 74 | 74 | { |
| 75 | - return $query->whereHas('slugs', function ($query) use ($slug) { |
|
| 75 | + return $query->whereHas('slugs', function($query) use ($slug) { |
|
| 76 | 76 | $query->whereSlug($slug); |
| 77 | 77 | $query->whereActive(true); |
| 78 | 78 | $query->whereLocale(app()->getLocale()); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function scopeForInactiveSlug($query, $slug) |
| 88 | 88 | { |
| 89 | - return $query->whereHas('slugs', function ($query) use ($slug) { |
|
| 89 | + return $query->whereHas('slugs', function($query) use ($slug) { |
|
| 90 | 90 | $query->whereSlug($slug); |
| 91 | 91 | $query->whereLocale(app()->getLocale()); |
| 92 | 92 | })->with(['slugs']); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function scopeForFallbackLocaleSlug($query, $slug) |
| 101 | 101 | { |
| 102 | - return $query->whereHas('slugs', function ($query) use ($slug) { |
|
| 102 | + return $query->whereHas('slugs', function($query) use ($slug) { |
|
| 103 | 103 | $query->whereSlug($slug); |
| 104 | 104 | $query->whereActive(true); |
| 105 | 105 | $query->whereLocale(config('translatable.fallback_locale')); |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | foreach ($slugParams as $key => $value) { |
| 156 | 156 | //check variations of the slug |
| 157 | 157 | if ($key == 'slug') { |
| 158 | - $query->where(function ($query) use ($value) { |
|
| 158 | + $query->where(function($query) use ($value) { |
|
| 159 | 159 | $query->orWhere('slug', $value); |
| 160 | 160 | $query->orWhere('slug', $value . '-' . $this->getSuffixSlug()); |
| 161 | 161 | for ($i = 2; $i <= $this->nb_variation_slug; $i++) { |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | */ |
| 236 | 236 | public function getActiveSlug($locale = null) |
| 237 | 237 | { |
| 238 | - return $this->slugs->first(function ($slug) use ($locale) { |
|
| 238 | + return $this->slugs->first(function($slug) use ($locale) { |
|
| 239 | 239 | return ($slug->locale === ($locale ?? app()->getLocale())) && $slug->active; |
| 240 | 240 | }) ?? null; |
| 241 | 241 | } |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | public function getFallbackActiveSlug() |
| 249 | 249 | { |
| 250 | - return $this->slugs->first(function ($slug) { |
|
| 250 | + return $this->slugs->first(function($slug) { |
|
| 251 | 251 | return $slug->locale === config('translatable.fallback_locale') && $slug->active; |
| 252 | 252 | }) ?? null; |
| 253 | 253 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function registerCapsules() |
| 43 | 43 | { |
| 44 | - $this->manager->getCapsuleList()->map(function ($capsule) { |
|
| 44 | + $this->manager->getCapsuleList()->map(function($capsule) { |
|
| 45 | 45 | $this->registerCapsule($capsule); |
| 46 | 46 | }); |
| 47 | 47 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | public function registerViewPaths() |
| 55 | 55 | { |
| 56 | 56 | if (file_exists(config('twill.capsules.path'))) { |
| 57 | - $callback = function ($view) { |
|
| 57 | + $callback = function($view) { |
|
| 58 | 58 | $view->addLocation(config('twill.capsules.path')); |
| 59 | 59 | }; |
| 60 | 60 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | if (!empty($ids)) { |
| 58 | 58 | foreach ($ids as $id) { |
| 59 | - $tagQuery->whereHas('tagged', function ($query) use ($id) { |
|
| 59 | + $tagQuery->whereHas('tagged', function($query) use ($id) { |
|
| 60 | 60 | $query->where('taggable_id', $id); |
| 61 | 61 | }); |
| 62 | 62 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function getTagsList() |
| 72 | 72 | { |
| 73 | - return $this->getTagsQuery()->where('count', '>', 0)->select('name', 'id')->get()->map(function ($tag) { |
|
| 73 | + return $this->getTagsQuery()->where('count', '>', 0)->select('name', 'id')->get()->map(function($tag) { |
|
| 74 | 74 | return [ |
| 75 | 75 | 'label' => $tag->name, |
| 76 | 76 | 'value' => $tag->id, |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | */ |
| 67 | 67 | protected function getRelatedBrowsers() |
| 68 | 68 | { |
| 69 | - return collect($this->relatedBrowsers)->map(function ($browser, $key) { |
|
| 69 | + return collect($this->relatedBrowsers)->map(function($browser, $key) { |
|
| 70 | 70 | $browserName = is_string($browser) ? $browser : $key; |
| 71 | 71 | $moduleName = !empty($browser['moduleName']) ? $browser['moduleName'] : $this->inferModuleNameFromBrowserName($browserName); |
| 72 | 72 | |
@@ -12,12 +12,12 @@ discard block |
||
| 12 | 12 | public function hydrateHandleRevisions($object, $fields) |
| 13 | 13 | { |
| 14 | 14 | // HandleRepeaters trait => getRepeaters |
| 15 | - foreach($this->getRepeaters() as $repeater) { |
|
| 15 | + foreach ($this->getRepeaters() as $repeater) { |
|
| 16 | 16 | $this->hydrateRepeater($object, $fields, $repeater['relation'], $repeater['model']); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | // HandleBrowers trait => getBrowsers |
| 20 | - foreach($this->getBrowsers() as $browser) { |
|
| 20 | + foreach ($this->getBrowsers() as $browser) { |
|
| 21 | 21 | $this->hydrateBrowser($object, $fields, $browser['relation'], $browser['positionAttribute'], $browser['model']); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $relatedElementsCollection = Collection::make(); |
| 99 | 99 | $position = 1; |
| 100 | 100 | |
| 101 | - $tableName = $object->$relationship() instanceof BelongsTo ? $object->$relationship->getTable() :$object->$relationship()->getTable(); |
|
| 101 | + $tableName = $object->$relationship() instanceof BelongsTo ? $object->$relationship->getTable() : $object->$relationship()->getTable(); |
|
| 102 | 102 | |
| 103 | 103 | foreach ($relatedElements as $relatedElement) { |
| 104 | 104 | $newRelatedElement = $relationRepository->getById($relatedElement['id']); |
@@ -42,12 +42,12 @@ |
||
| 42 | 42 | public function scopeVisible($query) |
| 43 | 43 | { |
| 44 | 44 | if ($this->isFillable('publish_start_date')) { |
| 45 | - $query->where(function ($query) { |
|
| 45 | + $query->where(function($query) { |
|
| 46 | 46 | $query->whereNull("{$this->getTable()}.publish_start_date")->orWhere("{$this->getTable()}.publish_start_date", '<=', Carbon::now()); |
| 47 | 47 | }); |
| 48 | 48 | |
| 49 | 49 | if ($this->isFillable('publish_end_date')) { |
| 50 | - $query->where(function ($query) { |
|
| 50 | + $query->where(function($query) { |
|
| 51 | 51 | $query->whereNull("{$this->getTable()}.publish_end_date")->orWhere("{$this->getTable()}.publish_end_date", '>=', Carbon::now()); |
| 52 | 52 | }); |
| 53 | 53 | } |