@@ -113,7 +113,7 @@ |
||
113 | 113 | |
114 | 114 | $params = ['fp-x' => $fpX, 'fp-y' => $fpY, 'fp-z' => $fpZ]; |
115 | 115 | |
116 | - return array_map(function ($param) { |
|
116 | + return array_map(function($param) { |
|
117 | 117 | return number_format($param, 4, ".", ""); |
118 | 118 | }, $params) + ['crop' => 'focalpoint', 'fit' => 'crop']; |
119 | 119 | } |
@@ -13,11 +13,11 @@ |
||
13 | 13 | |
14 | 14 | public function renderBlocks($renderChilds = true, $blockViewMappings = [], $data = []) |
15 | 15 | { |
16 | - return $this->blocks->where('parent_id', null)->map(function ($block) use ($blockViewMappings, $renderChilds, $data) { |
|
16 | + return $this->blocks->where('parent_id', null)->map(function($block) use ($blockViewMappings, $renderChilds, $data) { |
|
17 | 17 | if ($renderChilds) { |
18 | 18 | $childBlocks = $this->blocks->where('parent_id', $block->id); |
19 | 19 | |
20 | - $renderedChildViews = $childBlocks->map(function ($childBlock) use ($blockViewMappings, $data) { |
|
20 | + $renderedChildViews = $childBlocks->map(function($childBlock) use ($blockViewMappings, $data) { |
|
21 | 21 | $view = $this->getBlockView($childBlock->type, $blockViewMappings); |
22 | 22 | return view($view, $data)->with('block', $childBlock)->render(); |
23 | 23 | })->implode(''); |
@@ -7,7 +7,7 @@ |
||
7 | 7 | |
8 | 8 | protected static function bootHasPosition() |
9 | 9 | { |
10 | - static::creating(function ($model) { |
|
10 | + static::creating(function($model) { |
|
11 | 11 | $model->setToLastPosition(); |
12 | 12 | }); |
13 | 13 | } |
@@ -32,12 +32,12 @@ |
||
32 | 32 | public function scopeVisible($query) |
33 | 33 | { |
34 | 34 | if ($this->isFillable('publish_start_date')) { |
35 | - $query->where(function ($query) { |
|
35 | + $query->where(function($query) { |
|
36 | 36 | $query->whereNull('publish_start_date')->orWhere('publish_start_date', '<=', Carbon::now()); |
37 | 37 | }); |
38 | 38 | |
39 | 39 | if ($this->isFillable('publish_end_date')) { |
40 | - $query->where(function ($query) { |
|
40 | + $query->where(function($query) { |
|
41 | 41 | $query->whereNull('publish_end_date')->orWhere('publish_end_date', '>=', Carbon::now()); |
42 | 42 | }); |
43 | 43 | } |
@@ -14,8 +14,8 @@ |
||
14 | 14 | public function rules() |
15 | 15 | { |
16 | 16 | switch ($this->method()) { |
17 | - case 'POST':{return $this->rulesForCreate();} |
|
18 | - case 'PUT':{return $this->rulesForUpdate();} |
|
17 | + case 'POST':{return $this->rulesForCreate(); } |
|
18 | + case 'PUT':{return $this->rulesForUpdate(); } |
|
19 | 19 | default:break; |
20 | 20 | } |
21 | 21 |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | if (!empty($ids)) { |
48 | 48 | foreach ($ids as $id) { |
49 | - $tagQuery->whereHas('tagged', function ($query) use ($id) { |
|
49 | + $tagQuery->whereHas('tagged', function($query) use ($id) { |
|
50 | 50 | $query->where('taggable_id', $id); |
51 | 51 | }); |
52 | 52 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | public function getTagsList() |
59 | 59 | { |
60 | - return $this->getTagsQuery()->where('count', '>', 0)->select('name', 'id')->get()->map(function ($tag) { |
|
60 | + return $this->getTagsQuery()->where('count', '>', 0)->select('name', 'id')->get()->map(function($tag) { |
|
61 | 61 | return [ |
62 | 62 | 'label' => $tag->name, |
63 | 63 | 'value' => $tag->id, |
@@ -22,7 +22,7 @@ |
||
22 | 22 | { |
23 | 23 | $manageMultipleLanguages = count(getLocales()) > 1; |
24 | 24 | if ($manageMultipleLanguages && $translate) { |
25 | - $allLanguages = Collection::make(config('translatable.locales'))->map(function ($locale, $index) use ($form_fields) { |
|
25 | + $allLanguages = Collection::make(config('translatable.locales'))->map(function($locale, $index) use ($form_fields) { |
|
26 | 26 | return [ |
27 | 27 | 'shortlabel' => strtoupper($locale), |
28 | 28 | 'label' => getLanguageLabelFromLocaleCode($locale), |
@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | |
25 | 25 | public function __construct(array $attributes = []) |
26 | 26 | { |
27 | - $this->fillable(array_merge($this->fillable, Collection::make(config('twill.media_library.extra_metadatas_fields'))->map(function ($field) { |
|
27 | + $this->fillable(array_merge($this->fillable, Collection::make(config('twill.media_library.extra_metadatas_fields'))->map(function($field) { |
|
28 | 28 | return $field['name']; |
29 | 29 | })->toArray())); |
30 | 30 | |
31 | - Collection::make(config('twill.media_library.translatable_metadatas_fields'))->each(function ($field) { |
|
31 | + Collection::make(config('twill.media_library.translatable_metadatas_fields'))->each(function($field) { |
|
32 | 32 | $this->casts[$field] = 'json'; |
33 | 33 | }); |
34 | 34 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | 'medium' => ImageService::getUrl($this->uuid, ["h" => "430"]), |
66 | 66 | 'width' => $this->width, |
67 | 67 | 'height' => $this->height, |
68 | - 'tags' => $this->tags->map(function ($tag) { |
|
68 | + 'tags' => $this->tags->map(function($tag) { |
|
69 | 69 | return $tag->name; |
70 | 70 | }), |
71 | 71 | 'deleteUrl' => $this->canDeleteSafely() ? moduleRoute('medias', 'media-library', 'destroy', $this->id) : null, |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | 'caption' => $this->caption, |
78 | 78 | 'altText' => $this->alt_text, |
79 | 79 | 'video' => null, |
80 | - ] + Collection::make(config('twill.media_library.extra_metadatas_fields'))->mapWithKeys(function ($field) { |
|
80 | + ] + Collection::make(config('twill.media_library.extra_metadatas_fields'))->mapWithKeys(function($field) { |
|
81 | 81 | return [ |
82 | 82 | $field['name'] => $this->{$field['name']}, |
83 | 83 | ]; |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | |
13 | 13 | protected static function bootHasSlug() |
14 | 14 | { |
15 | - static::created(function ($model) { |
|
15 | + static::created(function($model) { |
|
16 | 16 | $model->setSlugs(); |
17 | 17 | }); |
18 | 18 | |
19 | - static::updated(function ($model) { |
|
19 | + static::updated(function($model) { |
|
20 | 20 | $model->setSlugs(); |
21 | 21 | }); |
22 | 22 | |
23 | - static::restored(function ($model) { |
|
23 | + static::restored(function($model) { |
|
24 | 24 | $model->setSlugs($restoring = true); |
25 | 25 | }); |
26 | 26 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | public function scopeForSlug($query, $slug) |
47 | 47 | { |
48 | - return $query->whereHas('slugs', function ($query) use ($slug) { |
|
48 | + return $query->whereHas('slugs', function($query) use ($slug) { |
|
49 | 49 | $query->whereSlug($slug); |
50 | 50 | $query->whereActive(true); |
51 | 51 | $query->whereLocale(app()->getLocale()); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | public function scopeForInactiveSlug($query, $slug) |
56 | 56 | { |
57 | - return $query->whereHas('slugs', function ($query) use ($slug) { |
|
57 | + return $query->whereHas('slugs', function($query) use ($slug) { |
|
58 | 58 | $query->whereSlug($slug); |
59 | 59 | $query->whereLocale(app()->getLocale()); |
60 | 60 | })->with(['slugs']); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | public function scopeForFallbackLocaleSlug($query, $slug) |
64 | 64 | { |
65 | - return $query->whereHas('slugs', function ($query) use ($slug) { |
|
65 | + return $query->whereHas('slugs', function($query) use ($slug) { |
|
66 | 66 | $query->whereSlug($slug); |
67 | 67 | $query->whereActive(true); |
68 | 68 | $query->whereLocale(config('translatable.fallback_locale')); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | foreach ($slugParams as $key => $value) { |
106 | 106 | //check variations of the slug |
107 | 107 | if ($key == 'slug') { |
108 | - $query->where(function ($query) use ($value) { |
|
108 | + $query->where(function($query) use ($value) { |
|
109 | 109 | $query->orWhere('slug', $value); |
110 | 110 | $query->orWhere('slug', $value . '-' . $this->getSuffixSlug()); |
111 | 111 | for ($i = 2; $i <= $this->nb_variation_slug; $i++) { |
@@ -174,14 +174,14 @@ discard block |
||
174 | 174 | |
175 | 175 | public function getActiveSlug($locale = null) |
176 | 176 | { |
177 | - return $this->slugs->first(function ($slug) use ($locale) { |
|
177 | + return $this->slugs->first(function($slug) use ($locale) { |
|
178 | 178 | return ($slug->locale === ($locale ?? app()->getLocale())) && $slug->active; |
179 | 179 | }) ?? null; |
180 | 180 | } |
181 | 181 | |
182 | 182 | public function getFallbackActiveSlug() |
183 | 183 | { |
184 | - return $this->slugs->first(function ($slug) { |
|
184 | + return $this->slugs->first(function($slug) { |
|
185 | 185 | return $slug->locale === config('translatable.fallback_locale') && $slug->active; |
186 | 186 | }) ?? null; |
187 | 187 | } |