@@ -16,7 +16,7 @@ |
||
| 16 | 16 | // TODO: document this and actually think about moving to queuable job after content type updates |
| 17 | 17 | public function handle() |
| 18 | 18 | { |
| 19 | - DB::table('mediables')->orderBy('id')->chunk(100, function ($attached_medias) { |
|
| 19 | + DB::table('mediables')->orderBy('id')->chunk(100, function($attached_medias) { |
|
| 20 | 20 | foreach ($attached_medias as $attached_media) { |
| 21 | 21 | $uuid = Media::withTrashed()->find($attached_media->media_id, ['uuid'])->uuid; |
| 22 | 22 | |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | public function handle() |
| 15 | 15 | { |
| 16 | 16 | $this->info("Starting to scan block views directory..."); |
| 17 | - collect(File::files(resource_path('views/admin/blocks')))->each(function ($viewFile) { |
|
| 17 | + collect(File::files(resource_path('views/admin/blocks')))->each(function($viewFile) { |
|
| 18 | 18 | $blockName = $viewFile->getBasename('.blade.php'); |
| 19 | 19 | |
| 20 | 20 | $vueBlockTemplate = view('admin.blocks.' . $blockName, ['renderForBlocks' => true])->render(); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | $locale = $locale ?? app()->getLocale(); |
| 18 | 18 | |
| 19 | 19 | if (!$file) { |
| 20 | - $file = $this->files->first(function ($file) use ($role, $locale) { |
|
| 20 | + $file = $this->files->first(function($file) use ($role, $locale) { |
|
| 21 | 21 | $localeScope = ($locale === 'fallback') ? true : ($file->pivot->locale === $locale); |
| 22 | 22 | return $file->pivot->role === $role && $localeScope; |
| 23 | 23 | }); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | $locale = $locale ?? app()->getLocale(); |
| 36 | 36 | |
| 37 | - $files = $this->files->filter(function ($file) use ($role, $locale) { |
|
| 37 | + $files = $this->files->filter(function($file) use ($role, $locale) { |
|
| 38 | 38 | return $file->pivot->role === $role && $file->pivot->locale === $locale; |
| 39 | 39 | }); |
| 40 | 40 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | { |
| 52 | 52 | $locale = $locale ?? app()->getLocale(); |
| 53 | 53 | |
| 54 | - return $this->files->first(function ($key, $file) use ($role, $locale) { |
|
| 54 | + return $this->files->first(function($key, $file) use ($role, $locale) { |
|
| 55 | 55 | return $file->pivot->role === $role && $file->pivot->locale === $locale; |
| 56 | 56 | }); |
| 57 | 57 | } |
@@ -11,14 +11,14 @@ |
||
| 11 | 11 | |
| 12 | 12 | public function scopeMine($query) |
| 13 | 13 | { |
| 14 | - return $query->whereHas('revisions', function ($query) { |
|
| 14 | + return $query->whereHas('revisions', function($query) { |
|
| 15 | 15 | $query->where('user_id', auth()->user()->id); |
| 16 | 16 | }); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | public function revisionsArray() |
| 20 | 20 | { |
| 21 | - return $this->revisions->map(function ($revision) { |
|
| 21 | + return $this->revisions->map(function($revision) { |
|
| 22 | 22 | return [ |
| 23 | 23 | 'id' => $revision->id, |
| 24 | 24 | 'author' => $revision->user->name ?? 'Unknown', |
@@ -10,15 +10,15 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | protected static function bootHasSlug() |
| 12 | 12 | { |
| 13 | - static::created(function ($model) { |
|
| 13 | + static::created(function($model) { |
|
| 14 | 14 | $model->setSlugs(); |
| 15 | 15 | }); |
| 16 | 16 | |
| 17 | - static::updated(function ($model) { |
|
| 17 | + static::updated(function($model) { |
|
| 18 | 18 | $model->setSlugs(); |
| 19 | 19 | }); |
| 20 | 20 | |
| 21 | - static::restored(function ($model) { |
|
| 21 | + static::restored(function($model) { |
|
| 22 | 22 | $model->setSlugs($restoring = true); |
| 23 | 23 | }); |
| 24 | 24 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function scopeForSlug($query, $slug) |
| 43 | 43 | { |
| 44 | - return $query->whereHas('slugs', function ($query) use ($slug) { |
|
| 44 | + return $query->whereHas('slugs', function($query) use ($slug) { |
|
| 45 | 45 | $query->whereSlug($slug); |
| 46 | 46 | $query->whereActive(true); |
| 47 | 47 | $query->whereLocale(app()->getLocale()); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | public function scopeForInactiveSlug($query, $slug) |
| 52 | 52 | { |
| 53 | - return $query->whereHas('slugs', function ($query) use ($slug) { |
|
| 53 | + return $query->whereHas('slugs', function($query) use ($slug) { |
|
| 54 | 54 | $query->whereSlug($slug); |
| 55 | 55 | $query->whereLocale(app()->getLocale()); |
| 56 | 56 | })->with(['slugs']); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | foreach ($slugParams as $key => $value) { |
| 93 | 93 | //check variations of the slug |
| 94 | 94 | if ($key == 'slug') { |
| 95 | - $query->where(function ($query) use ($value) { |
|
| 95 | + $query->where(function($query) use ($value) { |
|
| 96 | 96 | $query->orWhere('slug', $value); |
| 97 | 97 | $query->orWhere('slug', $value . '-' . $this->getSuffixSlug()); |
| 98 | 98 | for ($i = 2; $i <= $this->nb_variation_slug; $i++) { |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | public function getActiveSlug($locale = null) |
| 163 | 163 | { |
| 164 | - return $this->slugs->first(function ($slug) use ($locale) { |
|
| 164 | + return $this->slugs->first(function($slug) use ($locale) { |
|
| 165 | 165 | return ($slug->locale === ($locale ?? app()->getLocale())) && $slug->active; |
| 166 | 166 | }) ?? null; |
| 167 | 167 | } |
@@ -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(''); |
@@ -18,12 +18,12 @@ discard block |
||
| 18 | 18 | if (method_exists($query->getModel(), 'translations')) { |
| 19 | 19 | $locale = $locale == null ? app()->getLocale() : $locale; |
| 20 | 20 | |
| 21 | - $query->whereHas('translations', function ($query) use ($locale) { |
|
| 21 | + $query->whereHas('translations', function($query) use ($locale) { |
|
| 22 | 22 | $query->whereActive(true); |
| 23 | 23 | $query->whereLocale($locale); |
| 24 | 24 | }); |
| 25 | 25 | |
| 26 | - return $query->with(['translations' => function ($query) use ($locale) { |
|
| 26 | + return $query->with(['translations' => function($query) use ($locale) { |
|
| 27 | 27 | $query->whereActive(true); |
| 28 | 28 | $query->whereLocale($locale); |
| 29 | 29 | }]); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | public function getActiveLanguages() |
| 77 | 77 | { |
| 78 | - return $this->translations->map(function ($translation) { |
|
| 78 | + return $this->translations->map(function($translation) { |
|
| 79 | 79 | return [ |
| 80 | 80 | 'shortlabel' => strtoupper($translation->locale), |
| 81 | 81 | 'label' => getLanguageLabelFromLocaleCode($translation->locale), |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | public function translatedAttribute($key) |
| 92 | 92 | { |
| 93 | - return $this->translations->mapWithKeys(function ($translation) use ($key) { |
|
| 93 | + return $this->translations->mapWithKeys(function($translation) use ($key) { |
|
| 94 | 94 | return [$translation->locale => $this->translate($translation->locale)->$key]; |
| 95 | 95 | }); |
| 96 | 96 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | |
| 29 | 29 | if (!$media) { |
| 30 | - $media = $this->medias->first(function ($media) use ($role, $crop) { |
|
| 30 | + $media = $this->medias->first(function($media) use ($role, $crop) { |
|
| 31 | 31 | return $media->pivot->role === $role && $media->pivot->crop === $crop; |
| 32 | 32 | }); |
| 33 | 33 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | public function images($role, $crop = "default", $params = []) |
| 53 | 53 | { |
| 54 | - $medias = $this->medias->filter(function ($media) use ($role, $crop) { |
|
| 54 | + $medias = $this->medias->filter(function($media) use ($role, $crop) { |
|
| 55 | 55 | return $media->pivot->role === $role && $media->pivot->crop === $crop; |
| 56 | 56 | }); |
| 57 | 57 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | public function imageAsArray($role, $crop = "default", $params = [], $media = null) |
| 68 | 68 | { |
| 69 | 69 | if (!$media) { |
| 70 | - $media = $this->medias->first(function ($media) use ($role, $crop) { |
|
| 70 | + $media = $this->medias->first(function($media) use ($role, $crop) { |
|
| 71 | 71 | return $media->pivot->role === $role && $media->pivot->crop === $crop; |
| 72 | 72 | }); |
| 73 | 73 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | public function imagesAsArrays($role, $crop = "default", $params = []) |
| 90 | 90 | { |
| 91 | - $medias = $this->medias->filter(function ($media) use ($role, $crop) { |
|
| 91 | + $medias = $this->medias->filter(function($media) use ($role, $crop) { |
|
| 92 | 92 | return $media->pivot->role === $role && $media->pivot->crop === $crop; |
| 93 | 93 | }); |
| 94 | 94 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | public function imageAltText($role, $media = null) |
| 105 | 105 | { |
| 106 | 106 | if (!$media) { |
| 107 | - $media = $this->medias->first(function ($media) use ($role) { |
|
| 107 | + $media = $this->medias->first(function($media) use ($role) { |
|
| 108 | 108 | return $media->pivot->role === $role; |
| 109 | 109 | }); |
| 110 | 110 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | public function imageCaption($role, $media = null) |
| 120 | 120 | { |
| 121 | 121 | if (!$media) { |
| 122 | - $media = $this->medias->first(function ($media) use ($role) { |
|
| 122 | + $media = $this->medias->first(function($media) use ($role) { |
|
| 123 | 123 | return $media->pivot->role === $role; |
| 124 | 124 | }); |
| 125 | 125 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | public function imageVideo($role, $media = null) |
| 135 | 135 | { |
| 136 | 136 | if (!$media) { |
| 137 | - $media = $this->medias->first(function ($media) use ($role) { |
|
| 137 | + $media = $this->medias->first(function($media) use ($role) { |
|
| 138 | 138 | return $media->pivot->role === $role; |
| 139 | 139 | }); |
| 140 | 140 | } |
@@ -150,14 +150,14 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | public function imageObject($role, $crop = "default") |
| 152 | 152 | { |
| 153 | - return $this->medias->first(function ($media) use ($role, $crop) { |
|
| 153 | + return $this->medias->first(function($media) use ($role, $crop) { |
|
| 154 | 154 | return $media->pivot->role === $role && $media->pivot->crop === $crop; |
| 155 | 155 | }); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | public function lowQualityImagePlaceholder($role, $crop = "default", $params = [], $has_fallback = false) |
| 159 | 159 | { |
| 160 | - $media = $this->medias->first(function ($media) use ($role, $crop) { |
|
| 160 | + $media = $this->medias->first(function($media) use ($role, $crop) { |
|
| 161 | 161 | return $media->pivot->role === $role && $media->pivot->crop === $crop; |
| 162 | 162 | }); |
| 163 | 163 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | public function socialImage($role, $crop = "default", $params = [], $has_fallback = false) |
| 177 | 177 | { |
| 178 | - $media = $this->medias->first(function ($media) use ($role, $crop) { |
|
| 178 | + $media = $this->medias->first(function($media) use ($role, $crop) { |
|
| 179 | 179 | return $media->pivot->role === $role && $media->pivot->crop === $crop; |
| 180 | 180 | }); |
| 181 | 181 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | public function imageObjects($role, $crop = "default") |
| 212 | 212 | { |
| 213 | - return $this->medias->filter(function ($media) use ($role, $crop) { |
|
| 213 | + return $this->medias->filter(function($media) use ($role, $crop) { |
|
| 214 | 214 | return $media->pivot->role === $role && $media->pivot->crop === $crop; |
| 215 | 215 | }); |
| 216 | 216 | } |
@@ -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 | } |