@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | public static function bootHasMedias(): void |
21 | 21 | { |
22 | - self::deleted(static function (Model $model) { |
|
22 | + self::deleted(static function(Model $model) { |
|
23 | 23 | if (!method_exists($model, 'isForceDeleting') || $model->isForceDeleting()) { |
24 | 24 | /** @var \A17\Twill\Models\Behaviors\HasMedias $model */ |
25 | 25 | $model->medias()->detach(); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | private function findMedia($role, $crop = "default") |
56 | 56 | { |
57 | 57 | $foundMedia = false; |
58 | - $media = $this->medias->first(function ($media) use ($role, $crop, &$foundMedia) { |
|
58 | + $media = $this->medias->first(function($media) use ($role, $crop, &$foundMedia) { |
|
59 | 59 | if (config('twill.media_library.translated_form_fields', false)) { |
60 | 60 | $localeScope = $media->pivot->locale === app()->getLocale(); |
61 | 61 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | }); |
69 | 69 | |
70 | 70 | if (!$media && config('twill.media_library.translated_form_fields', false)) { |
71 | - $media = $this->medias->first(function ($media) use ($role, $crop, &$foundMedia) { |
|
71 | + $media = $this->medias->first(function($media) use ($role, $crop, &$foundMedia) { |
|
72 | 72 | if (!$foundMedia) { |
73 | 73 | $foundMedia = $media->pivot->role === $role; |
74 | 74 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function images($role, $crop = "default", $params = []) |
148 | 148 | { |
149 | - $medias = $this->medias->filter(function ($media) use ($role, $crop) { |
|
149 | + $medias = $this->medias->filter(function($media) use ($role, $crop) { |
|
150 | 150 | return $media->pivot->role === $role && $media->pivot->crop === $crop; |
151 | 151 | }); |
152 | 152 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | */ |
169 | 169 | public function imagesWithCrops($role, $params = []) |
170 | 170 | { |
171 | - $medias = $this->medias->filter(function ($media) use ($role) { |
|
171 | + $medias = $this->medias->filter(function($media) use ($role) { |
|
172 | 172 | return $media->pivot->role === $role; |
173 | 173 | }); |
174 | 174 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | */ |
222 | 222 | public function imagesAsArrays($role, $crop = "default", $params = []) |
223 | 223 | { |
224 | - $medias = $this->medias->filter(function ($media) use ($role, $crop) { |
|
224 | + $medias = $this->medias->filter(function($media) use ($role, $crop) { |
|
225 | 225 | return $media->pivot->role === $role && $media->pivot->crop === $crop; |
226 | 226 | }); |
227 | 227 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public function imagesAsArraysWithCrops($role, $params = []) |
245 | 245 | { |
246 | - $medias = $this->medias->filter(function ($media) use ($role) { |
|
246 | + $medias = $this->medias->filter(function($media) use ($role) { |
|
247 | 247 | return $media->pivot->role === $role; |
248 | 248 | }); |
249 | 249 | |
@@ -267,12 +267,12 @@ discard block |
||
267 | 267 | public function imageAltText($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 imageCaption($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 | |
@@ -319,12 +319,12 @@ discard block |
||
319 | 319 | public function imageVideo($role, $media = null) |
320 | 320 | { |
321 | 321 | if (!$media) { |
322 | - $media = $this->medias->first(function ($media) use ($role) { |
|
322 | + $media = $this->medias->first(function($media) use ($role) { |
|
323 | 323 | if (config('twill.media_library.translated_form_fields', false)) { |
324 | 324 | $localeScope = $media->pivot->locale === app()->getLocale(); |
325 | 325 | } |
326 | 326 | |
327 | - return $media->pivot->role === $role && ($localeScope ?? true);; |
|
327 | + return $media->pivot->role === $role && ($localeScope ?? true); ; |
|
328 | 328 | }); |
329 | 329 | } |
330 | 330 | |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | */ |
442 | 442 | public function imageObjects($role, $crop = "default") |
443 | 443 | { |
444 | - return $this->medias->filter(function ($media) use ($role, $crop) { |
|
444 | + return $this->medias->filter(function($media) use ($role, $crop) { |
|
445 | 445 | return $media->pivot->role === $role && $media->pivot->crop === $crop; |
446 | 446 | }); |
447 | 447 | } |
@@ -125,8 +125,7 @@ |
||
125 | 125 | $date = null; |
126 | 126 | if ($item->updated_at) { |
127 | 127 | $date = $item->updated_at->toIso8601String(); |
128 | - } |
|
129 | - elseif ($item->created_at) { |
|
128 | + } elseif ($item->created_at) { |
|
130 | 129 | $date = $item->created_at->toIso8601String(); |
131 | 130 | } |
132 | 131 |