@@ -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 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | public static function supportsBladeComponents(): bool { |
| 141 | - return (int)explode('.', app()->version())[0] >= 7; |
|
| 141 | + return (int) explode('.', app()->version())[0] >= 7; |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -153,13 +153,13 @@ discard block |
||
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | if (config('twill.enabled.media-library')) { |
| 156 | - $this->app->singleton('imageService', function () { |
|
| 156 | + $this->app->singleton('imageService', function() { |
|
| 157 | 157 | return $this->app->make(config('twill.media_library.image_service')); |
| 158 | 158 | }); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | if (config('twill.enabled.file-library')) { |
| 162 | - $this->app->singleton('fileService', function () { |
|
| 162 | + $this->app->singleton('fileService', function() { |
|
| 163 | 163 | return $this->app->make(config('twill.file_library.file_service')); |
| 164 | 164 | }); |
| 165 | 165 | } |
@@ -397,20 +397,20 @@ discard block |
||
| 397 | 397 | { |
| 398 | 398 | $blade = $this->app['view']->getEngineResolver()->resolve('blade')->getCompiler(); |
| 399 | 399 | |
| 400 | - $blade->directive('dd', function ($param) { |
|
| 400 | + $blade->directive('dd', function($param) { |
|
| 401 | 401 | return "<?php dd({$param}); ?>"; |
| 402 | 402 | }); |
| 403 | 403 | |
| 404 | - $blade->directive('dumpData', function ($data) { |
|
| 404 | + $blade->directive('dumpData', function($data) { |
|
| 405 | 405 | return sprintf("<?php (new Symfony\Component\VarDumper\VarDumper)->dump(%s); exit; ?>", |
| 406 | 406 | null != $data ? $data : "get_defined_vars()"); |
| 407 | 407 | }); |
| 408 | 408 | |
| 409 | - $blade->directive('formField', function ($expression) { |
|
| 409 | + $blade->directive('formField', function($expression) { |
|
| 410 | 410 | return $this->includeView('partials.form._', $expression); |
| 411 | 411 | }); |
| 412 | 412 | |
| 413 | - $blade->directive('partialView', function ($expression) { |
|
| 413 | + $blade->directive('partialView', function($expression) { |
|
| 414 | 414 | $expressionAsArray = str_getcsv($expression, ',', '\''); |
| 415 | 415 | |
| 416 | 416 | [$moduleName, $viewName] = $expressionAsArray; |
@@ -445,13 +445,13 @@ discard block |
||
| 445 | 445 | ?>"; |
| 446 | 446 | }); |
| 447 | 447 | |
| 448 | - $blade->directive('pushonce', function ($expression) { |
|
| 448 | + $blade->directive('pushonce', function($expression) { |
|
| 449 | 449 | [$pushName, $pushSub] = explode(':', trim(substr($expression, 1, -1))); |
| 450 | 450 | $key = '__pushonce_' . $pushName . '_' . str_replace('-', '_', $pushSub); |
| 451 | 451 | return "<?php if(! isset(\$__env->{$key})): \$__env->{$key} = 1; \$__env->startPush('{$pushName}'); ?>"; |
| 452 | 452 | }); |
| 453 | 453 | |
| 454 | - $blade->directive('endpushonce', function () { |
|
| 454 | + $blade->directive('endpushonce', function() { |
|
| 455 | 455 | return '<?php $__env->stopPush(); endif; ?>'; |
| 456 | 456 | }); |
| 457 | 457 | |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | |
| 492 | 492 | View::composer('twill::partials.navigation.*', ActiveNavigation::class); |
| 493 | 493 | |
| 494 | - View::composer(['admin.*', 'templates.*', 'twill::*'], function ($view) { |
|
| 494 | + View::composer(['admin.*', 'templates.*', 'twill::*'], function($view) { |
|
| 495 | 495 | $with = array_merge([ |
| 496 | 496 | 'renderForBlocks' => false, |
| 497 | 497 | 'renderForModal' => false, |
@@ -69,18 +69,18 @@ |
||
| 69 | 69 | public function render() |
| 70 | 70 | { |
| 71 | 71 | if ($this->toolbarOptions) { |
| 72 | - $toolbarOptions = array_map(static function ($option) { |
|
| 72 | + $toolbarOptions = array_map(static function($option) { |
|
| 73 | 73 | if ($option === 'list-unordered') { |
| 74 | - return (object)['list' => 'bullet']; |
|
| 74 | + return (object) ['list' => 'bullet']; |
|
| 75 | 75 | } |
| 76 | 76 | if ($option === 'list-ordered') { |
| 77 | - return (object)['list' => 'ordered']; |
|
| 77 | + return (object) ['list' => 'ordered']; |
|
| 78 | 78 | } |
| 79 | 79 | if ($option === 'h1') { |
| 80 | - return (object)['header' => 1]; |
|
| 80 | + return (object) ['header' => 1]; |
|
| 81 | 81 | } |
| 82 | 82 | if ($option === 'h2') { |
| 83 | - return (object)['header' => 2]; |
|
| 83 | + return (object) ['header' => 2]; |
|
| 84 | 84 | } |
| 85 | 85 | return $option; |
| 86 | 86 | }, $this->toolbarOptions); |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | public function render() |
| 62 | 62 | { |
| 63 | 63 | return view('twill::partials.form._input', [ |
| 64 | - 'onChangeFullAttribute' => $this->onChangeAttribute ? "('".$this->onChangeAttribute."', ...arguments)" : "", |
|
| 64 | + 'onChangeFullAttribute' => $this->onChangeAttribute ? "('" . $this->onChangeAttribute . "', ...arguments)" : "", |
|
| 65 | 65 | ]); |
| 66 | 66 | } |
| 67 | 67 | } |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | public function getOptions(): array |
| 69 | 69 | { |
| 70 | 70 | return is_object($this->options) && method_exists($this->options, 'map') ? $this->options->map( |
| 71 | - function ($label, $value) { |
|
| 71 | + function($label, $value) { |
|
| 72 | 72 | return [ |
| 73 | 73 | 'value' => $value, |
| 74 | 74 | 'label' => $label, |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | $this->routePrefix = $routePrefix; |
| 58 | 58 | $this->params = $params; |
| 59 | 59 | |
| 60 | - $endpointsFromModules = isset($this->modules) ? collect($this->modules)->map(function ($module) { |
|
| 60 | + $endpointsFromModules = isset($this->modules) ? collect($this->modules)->map(function($module) { |
|
| 61 | 61 | return [ |
| 62 | 62 | 'label' => $module['label'] ?? ucfirst($module['name']), |
| 63 | 63 | 'value' => moduleRoute( |