@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | if (!isset($this->defaultFilters)) { |
129 | 129 | $this->defaultFilters = [ |
130 | - 'search' => ($this->moduleHas('translations') ? '' : '%').$this->titleColumnKey, |
|
130 | + 'search' => ($this->moduleHas('translations') ? '' : '%') . $this->titleColumnKey, |
|
131 | 131 | ]; |
132 | 132 | } |
133 | 133 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | "$this->viewPrefix.index", |
188 | 188 | "twill::$this->moduleName.index", |
189 | 189 | 'twill::layouts.listing', |
190 | - ])->first(function ($view) { |
|
190 | + ])->first(function($view) { |
|
191 | 191 | return view()->exists($view); |
192 | 192 | }); |
193 | 193 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | |
211 | 211 | $this->fireEvent($input); |
212 | 212 | |
213 | - Session::put($this->moduleName.'_retain', true); |
|
213 | + Session::put($this->moduleName . '_retain', true); |
|
214 | 214 | |
215 | 215 | if ($this->getIndexOption('editInModal')) { |
216 | 216 | return $this->respondWithSuccess('Content saved. All good!'); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | "$this->viewPrefix.form", |
251 | 251 | "twill::$this->moduleName.form", |
252 | 252 | 'twill::layouts.form', |
253 | - ])->first(function ($view) { |
|
253 | + ])->first(function($view) { |
|
254 | 254 | return view()->exists($view); |
255 | 255 | }); |
256 | 256 | |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | $this->app->setLocale(request('activeLanguage')); |
315 | 315 | } |
316 | 316 | |
317 | - $previewView = $this->previewView ?? ('site.'.str_singular($this->moduleName)); |
|
317 | + $previewView = $this->previewView ?? ('site.' . str_singular($this->moduleName)); |
|
318 | 318 | |
319 | 319 | return view($previewView, array_replace([ |
320 | 320 | 'item' => $item, |
@@ -330,13 +330,13 @@ discard block |
||
330 | 330 | activity()->performedOn( |
331 | 331 | $this->repository->getById(request('id')) |
332 | 332 | )->log( |
333 | - (request('active') ? 'un' : '').'published' |
|
333 | + (request('active') ? 'un' : '') . 'published' |
|
334 | 334 | ); |
335 | 335 | |
336 | 336 | $this->fireEvent(); |
337 | 337 | |
338 | 338 | return $this->respondWithSuccess( |
339 | - $this->modelTitle.' '.(request('active') ? 'un' : '').'published!' |
|
339 | + $this->modelTitle . ' ' . (request('active') ? 'un' : '') . 'published!' |
|
340 | 340 | ); |
341 | 341 | } |
342 | 342 | } catch (\Exception $e) { |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | } |
345 | 345 | |
346 | 346 | return $this->respondWithError( |
347 | - $this->modelTitle.' was not published. Something wrong happened!' |
|
347 | + $this->modelTitle . ' was not published. Something wrong happened!' |
|
348 | 348 | ); |
349 | 349 | } |
350 | 350 | |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | $this->fireEvent(); |
358 | 358 | |
359 | 359 | return $this->respondWithSuccess( |
360 | - $this->modelTitle.' items '.(request('publish') ? '' : 'un').'published!' |
|
360 | + $this->modelTitle . ' items ' . (request('publish') ? '' : 'un') . 'published!' |
|
361 | 361 | ); |
362 | 362 | } |
363 | 363 | } catch (\Exception $e) { |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | } |
366 | 366 | |
367 | 367 | return $this->respondWithError( |
368 | - $this->modelTitle.' items were not published. Something wrong happened!' |
|
368 | + $this->modelTitle . ' items were not published. Something wrong happened!' |
|
369 | 369 | ); |
370 | 370 | } |
371 | 371 | |
@@ -376,10 +376,10 @@ discard block |
||
376 | 376 | $this->fireEvent(); |
377 | 377 | activity()->performedOn($item)->log('deleted'); |
378 | 378 | |
379 | - return $this->respondWithSuccess($this->modelTitle.' moved to trash!'); |
|
379 | + return $this->respondWithSuccess($this->modelTitle . ' moved to trash!'); |
|
380 | 380 | } |
381 | 381 | |
382 | - return $this->respondWithError($this->modelTitle.' was not moved to trash. Something wrong happened!'); |
|
382 | + return $this->respondWithError($this->modelTitle . ' was not moved to trash. Something wrong happened!'); |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | public function bulkDelete() |
@@ -387,10 +387,10 @@ discard block |
||
387 | 387 | if ($this->repository->bulkDelete(explode(',', request('ids')))) { |
388 | 388 | $this->fireEvent(); |
389 | 389 | |
390 | - return $this->respondWithSuccess($this->modelTitle.' items moved to trash!'); |
|
390 | + return $this->respondWithSuccess($this->modelTitle . ' items moved to trash!'); |
|
391 | 391 | } |
392 | 392 | |
393 | - return $this->respondWithError($this->modelTitle.' items were not moved to trash. Something wrong happened!'); |
|
393 | + return $this->respondWithError($this->modelTitle . ' items were not moved to trash. Something wrong happened!'); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | public function restore() |
@@ -399,10 +399,10 @@ discard block |
||
399 | 399 | $this->fireEvent(); |
400 | 400 | activity()->performedOn($this->repository->getById(request('id')))->log('restored'); |
401 | 401 | |
402 | - return $this->respondWithSuccess($this->modelTitle.' restored!'); |
|
402 | + return $this->respondWithSuccess($this->modelTitle . ' restored!'); |
|
403 | 403 | } |
404 | 404 | |
405 | - return $this->respondWithError($this->modelTitle.' was not restored. Something wrong happened!'); |
|
405 | + return $this->respondWithError($this->modelTitle . ' was not restored. Something wrong happened!'); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | public function bulkRestore() |
@@ -410,10 +410,10 @@ discard block |
||
410 | 410 | if ($this->repository->bulkRestore(explode(',', request('ids')))) { |
411 | 411 | $this->fireEvent(); |
412 | 412 | |
413 | - return $this->respondWithSuccess($this->modelTitle.' items restored!'); |
|
413 | + return $this->respondWithSuccess($this->modelTitle . ' items restored!'); |
|
414 | 414 | } |
415 | 415 | |
416 | - return $this->respondWithError($this->modelTitle.' items were not restored. Something wrong happened!'); |
|
416 | + return $this->respondWithError($this->modelTitle . ' items were not restored. Something wrong happened!'); |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | public function feature() |
@@ -434,15 +434,15 @@ discard block |
||
434 | 434 | activity()->performedOn( |
435 | 435 | $this->repository->getById($id) |
436 | 436 | )->log( |
437 | - (request('active') ? 'un' : '').'featured' |
|
437 | + (request('active') ? 'un' : '') . 'featured' |
|
438 | 438 | ); |
439 | 439 | |
440 | 440 | $this->fireEvent(); |
441 | 441 | |
442 | - return $this->respondWithSuccess($this->modelTitle.' '.(request('active') ? 'un' : '').'featured!'); |
|
442 | + return $this->respondWithSuccess($this->modelTitle . ' ' . (request('active') ? 'un' : '') . 'featured!'); |
|
443 | 443 | } |
444 | 444 | |
445 | - return $this->respondWithError($this->modelTitle.' was not featured. Something wrong happened!'); |
|
445 | + return $this->respondWithError($this->modelTitle . ' was not featured. Something wrong happened!'); |
|
446 | 446 | } |
447 | 447 | |
448 | 448 | public function bulkFeature() |
@@ -454,10 +454,10 @@ discard block |
||
454 | 454 | $this->repository->updateBasic($ids, [$featuredField => $featured]); |
455 | 455 | $this->fireEvent(); |
456 | 456 | |
457 | - return $this->respondWithSuccess($this->modelTitle.' items '.(request('feature') ? '' : 'un').'featured!'); |
|
457 | + return $this->respondWithSuccess($this->modelTitle . ' items ' . (request('feature') ? '' : 'un') . 'featured!'); |
|
458 | 458 | } |
459 | 459 | |
460 | - return $this->respondWithError($this->modelTitle.' items were not featured. Something wrong happened!'); |
|
460 | + return $this->respondWithError($this->modelTitle . ' items were not featured. Something wrong happened!'); |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | public function reorder() |
@@ -466,10 +466,10 @@ discard block |
||
466 | 466 | $this->repository->setNewOrder($values); |
467 | 467 | $this->fireEvent(); |
468 | 468 | |
469 | - return $this->respondWithSuccess($this->modelTitle.' order changed!'); |
|
469 | + return $this->respondWithSuccess($this->modelTitle . ' order changed!'); |
|
470 | 470 | } |
471 | 471 | |
472 | - return $this->respondWithError($this->modelTitle.' order was not changed. Something wrong happened!'); |
|
472 | + return $this->respondWithError($this->modelTitle . ' order was not changed. Something wrong happened!'); |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | public function tags() |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | $query = $this->request->input('q'); |
478 | 478 | $tags = $this->repository->getTags($query); |
479 | 479 | |
480 | - return response()->json(['items' => $tags->map(function ($tag) { |
|
480 | + return response()->json(['items' => $tags->map(function($tag) { |
|
481 | 481 | return $tag->name; |
482 | 482 | })], 200); |
483 | 483 | } |
@@ -541,8 +541,8 @@ discard block |
||
541 | 541 | { |
542 | 542 | $translated = $this->moduleHas('translations'); |
543 | 543 | |
544 | - return $items->map(function ($item) use ($translated) { |
|
545 | - $columnsData = collect($this->indexColumns)->mapWithKeys(function ($column) use ($item) { |
|
544 | + return $items->map(function($item) use ($translated) { |
|
545 | + $columnsData = collect($this->indexColumns)->mapWithKeys(function($column) use ($item) { |
|
546 | 546 | return $this->getItemColumnData($item, $column); |
547 | 547 | })->toArray(); |
548 | 548 | |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | } |
558 | 558 | } |
559 | 559 | |
560 | - $name = $name ?? ('Missing '.$this->titleColumnKey); |
|
560 | + $name = $name ?? ('Missing ' . $this->titleColumnKey); |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | unset($columnsData[$this->titleColumnKey]); |
@@ -619,16 +619,16 @@ discard block |
||
619 | 619 | $nestedCount = $item->{$column['nested']}->count(); |
620 | 620 | $value = '<a href="'; |
621 | 621 | $value .= moduleRoute("$this->moduleName.$field", $this->routePrefix, 'index', [$item->id]); |
622 | - $value .= '">'.$nestedCount.' '.(strtolower($nestedCount > 1 |
|
622 | + $value .= '">' . $nestedCount . ' ' . (strtolower($nestedCount > 1 |
|
623 | 623 | ? str_plural($column['title']) |
624 | - : str_singular($column['title']))).'</a>'; |
|
624 | + : str_singular($column['title']))) . '</a>'; |
|
625 | 625 | } else { |
626 | 626 | $field = $column['field']; |
627 | 627 | $value = $item->$field; |
628 | 628 | } |
629 | 629 | |
630 | 630 | if (isset($column['relationship'])) { |
631 | - $field = $column['relationship'].ucfirst($column['field']); |
|
631 | + $field = $column['relationship'] . ucfirst($column['field']); |
|
632 | 632 | $value = array_get($item, "{$column['relationship']}.{$column['field']}"); |
633 | 633 | } elseif (isset($column['present']) && $column['present']) { |
634 | 634 | $value = $item->presentAdmin()->{$column['field']}; |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | |
690 | 690 | foreach ($this->indexColumns as $column) { |
691 | 691 | $columnName = isset($column['relationship']) |
692 | - ? $column['relationship'].ucfirst($column['field']) |
|
692 | + ? $column['relationship'] . ucfirst($column['field']) |
|
693 | 693 | : (isset($column['nested']) ? $column['nested'] : $column['field']); |
694 | 694 | |
695 | 695 | array_push($tableColumns, [ |
@@ -772,9 +772,9 @@ discard block |
||
772 | 772 | 'feature', |
773 | 773 | 'bulkFeature', |
774 | 774 | 'bulkDelete', |
775 | - ])->mapWithKeys(function ($endpoint) use ($moduleName, $routePrefix) { |
|
775 | + ])->mapWithKeys(function($endpoint) use ($moduleName, $routePrefix) { |
|
776 | 776 | return [ |
777 | - $endpoint.'Url' => $this->getIndexOption($endpoint) ? moduleRoute( |
|
777 | + $endpoint . 'Url' => $this->getIndexOption($endpoint) ? moduleRoute( |
|
778 | 778 | $this->moduleName, $this->routePrefix, $endpoint, |
779 | 779 | $this->submodule ? [$this->submoduleParentId] : [] |
780 | 780 | ) : null, |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | |
785 | 785 | protected function getIndexOption($option) |
786 | 786 | { |
787 | - return once(function () use ($option) { |
|
787 | + return once(function() use ($option) { |
|
788 | 788 | $customOptionNamesMapping = [ |
789 | 789 | 'store' => 'create', |
790 | 790 | ]; |
@@ -830,8 +830,8 @@ discard block |
||
830 | 830 | { |
831 | 831 | $withImage = $this->moduleHas('medias'); |
832 | 832 | |
833 | - return $items->map(function ($item) { |
|
834 | - $columnsData = collect($this->browserColumns)->mapWithKeys(function ($column) use ($item) { |
|
833 | + return $items->map(function($item) { |
|
834 | + $columnsData = collect($this->browserColumns)->mapWithKeys(function($column) use ($item) { |
|
835 | 835 | return $this->getItemColumnData($item, $column); |
836 | 836 | })->toArray(); |
837 | 837 | |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | $fieldSplitted = explode('|', $field); |
887 | 887 | if (count($fieldSplitted) > 1) { |
888 | 888 | $requestValue = $requestFilters[$key]; |
889 | - collect($fieldSplitted)->each(function ($scopeKey) use (&$scope, $requestValue) { |
|
889 | + collect($fieldSplitted)->each(function($scopeKey) use (&$scope, $requestValue) { |
|
890 | 890 | $scope[$scopeKey] = $requestValue; |
891 | 891 | }); |
892 | 892 | } else { |
@@ -934,9 +934,9 @@ discard block |
||
934 | 934 | { |
935 | 935 | $item = $this->repository->getById($id, $this->formWith, $this->formWithCount); |
936 | 936 | |
937 | - $fullRoutePrefix = 'admin.'.($this->routePrefix ? $this->routePrefix.'.' : '').$this->moduleName.'.'; |
|
938 | - $previewRouteName = $fullRoutePrefix.'preview'; |
|
939 | - $restoreRouteName = $fullRoutePrefix.'restoreRevision'; |
|
937 | + $fullRoutePrefix = 'admin.' . ($this->routePrefix ? $this->routePrefix . '.' : '') . $this->moduleName . '.'; |
|
938 | + $previewRouteName = $fullRoutePrefix . 'preview'; |
|
939 | + $restoreRouteName = $fullRoutePrefix . 'restoreRevision'; |
|
940 | 940 | |
941 | 941 | $baseUrl = $item->urlWithoutSlug ?? $this->getPermalinkBaseUrl(); |
942 | 942 | |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | |
1006 | 1006 | protected function validateFormRequest() |
1007 | 1007 | { |
1008 | - return $this->app->make("$this->namespace\Http\Requests\Admin\\".$this->modelName.'Request'); |
|
1008 | + return $this->app->make("$this->namespace\Http\Requests\Admin\\" . $this->modelName . 'Request'); |
|
1009 | 1009 | } |
1010 | 1010 | |
1011 | 1011 | protected function getNamespace() |
@@ -1031,7 +1031,7 @@ discard block |
||
1031 | 1031 | |
1032 | 1032 | protected function getRepository() |
1033 | 1033 | { |
1034 | - return $this->app->make("$this->namespace\Repositories\\".$this->modelName.'Repository'); |
|
1034 | + return $this->app->make("$this->namespace\Repositories\\" . $this->modelName . 'Repository'); |
|
1035 | 1035 | } |
1036 | 1036 | |
1037 | 1037 | protected function getViewPrefix() |
@@ -1046,12 +1046,12 @@ discard block |
||
1046 | 1046 | |
1047 | 1047 | protected function getParentModuleForeignKey() |
1048 | 1048 | { |
1049 | - return str_singular(explode('.', $this->moduleName)[0]).'_id'; |
|
1049 | + return str_singular(explode('.', $this->moduleName)[0]) . '_id'; |
|
1050 | 1050 | } |
1051 | 1051 | |
1052 | 1052 | protected function getPermalinkBaseUrl() |
1053 | 1053 | { |
1054 | - return request()->getScheme().'://'.config('app.url').'/' |
|
1054 | + return request()->getScheme() . '://' . config('app.url') . '/' |
|
1055 | 1055 | .($this->moduleHas('translations') ? '{language}/' : '') |
1056 | 1056 | .($this->moduleHas('revisions') ? '{preview}/' : '') |
1057 | 1057 | .($this->permalinkBase ?? $this->moduleName) |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | |
1061 | 1061 | protected function getPermalinkPrefix($baseUrl) |
1062 | 1062 | { |
1063 | - return rtrim(str_replace(['http://', 'https://', '{preview}/', '{language}/'], '', $baseUrl), '/').'/'; |
|
1063 | + return rtrim(str_replace(['http://', 'https://', '{preview}/', '{language}/'], '', $baseUrl), '/') . '/'; |
|
1064 | 1064 | } |
1065 | 1065 | |
1066 | 1066 | protected function getModuleRoute($id, $action) |
@@ -1075,7 +1075,7 @@ discard block |
||
1075 | 1075 | |
1076 | 1076 | protected function moduleHas($behavior) |
1077 | 1077 | { |
1078 | - return classHasTrait($this->repository, 'A17\Twill\Repositories\Behaviors\Handle'.ucfirst($behavior)); |
|
1078 | + return classHasTrait($this->repository, 'A17\Twill\Repositories\Behaviors\Handle' . ucfirst($behavior)); |
|
1079 | 1079 | } |
1080 | 1080 | |
1081 | 1081 | protected function setBackLink($back_link = null, $params = []) |
@@ -1091,10 +1091,10 @@ discard block |
||
1091 | 1091 | } |
1092 | 1092 | } |
1093 | 1093 | |
1094 | - if (!Session::get($this->moduleName.'_retain')) { |
|
1094 | + if (!Session::get($this->moduleName . '_retain')) { |
|
1095 | 1095 | Session::put($this->getBackLinkSessionKey(), $back_link); |
1096 | 1096 | } else { |
1097 | - Session::put($this->moduleName.'_retain', false); |
|
1097 | + Session::put($this->moduleName . '_retain', false); |
|
1098 | 1098 | } |
1099 | 1099 | } |
1100 | 1100 | |
@@ -1107,12 +1107,12 @@ discard block |
||
1107 | 1107 | |
1108 | 1108 | protected function getBackLinkSessionKey() |
1109 | 1109 | { |
1110 | - return $this->moduleName.($this->submodule ? $this->submoduleParentId ?? '' : '').'_back_link'; |
|
1110 | + return $this->moduleName . ($this->submodule ? $this->submoduleParentId ?? '' : '') . '_back_link'; |
|
1111 | 1111 | } |
1112 | 1112 | |
1113 | 1113 | protected function redirectToForm($id, $params = []) |
1114 | 1114 | { |
1115 | - Session::put($this->moduleName.'_retain', true); |
|
1115 | + Session::put($this->moduleName . '_retain', true); |
|
1116 | 1116 | |
1117 | 1117 | return redirect(moduleRoute( |
1118 | 1118 | $this->moduleName, |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | $featuredSources = $this->getFeaturedSources($featuredSection, $filters['search'] ?? ''); |
20 | 20 | |
21 | - $contentTypes = collect($featuredSources)->map(function ($source, $sourceKey) { |
|
21 | + $contentTypes = collect($featuredSources)->map(function($source, $sourceKey) { |
|
22 | 22 | return [ |
23 | 23 | 'label' => $source['name'], |
24 | 24 | 'value' => $sourceKey, |
@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | })->values()->toArray(); |
27 | 27 | |
28 | 28 | if (request()->has('content_type')) { |
29 | - $source = array_first($featuredSources, function ($source, $sourceKey) { |
|
29 | + $source = array_first($featuredSources, function($source, $sourceKey) { |
|
30 | 30 | return $sourceKey == request('content_type'); |
31 | 31 | }); |
32 | 32 | |
33 | 33 | return [ |
34 | 34 | 'source' => [ |
35 | - 'content_type' => array_first($contentTypes, function ($contentTypeItem) { |
|
35 | + 'content_type' => array_first($contentTypes, function($contentTypeItem) { |
|
36 | 36 | return $contentTypeItem['value'] == request('content_type'); |
37 | 37 | }), |
38 | 38 | 'items' => $source['items'], |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | $bucketRouteConfig = config('twill.bucketsRoutes') ?? [$featuredSectionKey => 'featured']; |
75 | 75 | |
76 | - return collect($featuredSection['buckets'])->map(function ($bucket, $bucketKey) use ($featuredSectionKey, $bucketRouteConfig) { |
|
76 | + return collect($featuredSection['buckets'])->map(function($bucket, $bucketKey) use ($featuredSectionKey, $bucketRouteConfig) { |
|
77 | 77 | $routePrefix = $bucketRouteConfig[$featuredSectionKey]; |
78 | 78 | |
79 | 79 | return [ |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | 'acceptedSources' => collect($bucket['bucketables'])->pluck('module'), |
84 | 84 | 'withToggleFeatured' => $bucket['with_starred_items'] ?? false, |
85 | 85 | 'toggleFeaturedLabels' => $bucket['starred_items_labels'] ?? [], |
86 | - 'children' => Feature::where('bucket_key', $bucketKey)->with('featured')->get()->map(function ($feature) { |
|
86 | + 'children' => Feature::where('bucket_key', $bucketKey)->with('featured')->get()->map(function($feature) { |
|
87 | 87 | if (($item = $feature->featured) != null) { |
88 | 88 | $repository = $this->getRepository($feature->featured_type); |
89 | 89 | $withImage = classHasTrait($repository, HandleMedias::class); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | 'thumbnail' => $item->defaultCmsImage(['w' => 100, 'h' => 100]), |
102 | 102 | ] : []); |
103 | 103 | } |
104 | - })->reject(function ($item) { |
|
104 | + })->reject(function($item) { |
|
105 | 105 | return is_null($item); |
106 | 106 | })->values()->toArray(), |
107 | 107 | ]; |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | $fetchedModules = []; |
114 | 114 | $featuredSources = []; |
115 | 115 | |
116 | - collect($featuredSection['buckets'])->map(function ($bucket, $bucketKey) use (&$fetchedModules, $search) { |
|
117 | - return collect($bucket['bucketables'])->mapWithKeys(function ($bucketable) use (&$fetchedModules, $bucketKey, $search) { |
|
116 | + collect($featuredSection['buckets'])->map(function($bucket, $bucketKey) use (&$fetchedModules, $search) { |
|
117 | + return collect($bucket['bucketables'])->mapWithKeys(function($bucketable) use (&$fetchedModules, $bucketKey, $search) { |
|
118 | 118 | $module = $bucketable['module']; |
119 | 119 | $repository = $this->getRepository($module); |
120 | 120 | $translated = classHasTrait($repository, HandleTranslations::class); |
@@ -142,12 +142,12 @@ discard block |
||
142 | 142 | 'withImage' => $withImage, |
143 | 143 | ]]; |
144 | 144 | }); |
145 | - })->each(function ($bucketables, $bucket) use (&$featuredSources) { |
|
146 | - $bucketables->each(function ($bucketableData, $bucketable) use ($bucket, &$featuredSources) { |
|
145 | + })->each(function($bucketables, $bucket) use (&$featuredSources) { |
|
146 | + $bucketables->each(function($bucketableData, $bucketable) use ($bucket, &$featuredSources) { |
|
147 | 147 | $featuredSources[$bucketable]['name'] = $bucketableData['name']; |
148 | 148 | $featuredSources[$bucketable]['maxPage'] = $bucketableData['items']->lastPage(); |
149 | 149 | $featuredSources[$bucketable]['offset'] = $bucketableData['items']->perPage(); |
150 | - $featuredSources[$bucketable]['items'] = $bucketableData['items']->map(function ($item) use ($bucketableData, $bucketable) { |
|
150 | + $featuredSources[$bucketable]['items'] = $bucketableData['items']->map(function($item) use ($bucketableData, $bucketable) { |
|
151 | 151 | return [ |
152 | 152 | 'id' => $item->id, |
153 | 153 | 'name' => $item->titleInBucket ?? $item->title, |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | |
171 | 171 | public function save() |
172 | 172 | { |
173 | - DB::transaction(function () { |
|
174 | - collect(request('buckets'))->each(function ($bucketables, $bucketKey) { |
|
173 | + DB::transaction(function() { |
|
174 | + collect(request('buckets'))->each(function($bucketables, $bucketKey) { |
|
175 | 175 | Feature::where('bucket_key', $bucketKey)->delete(); |
176 | 176 | foreach (($bucketables ?? []) as $position => $bucketable) { |
177 | 177 | Feature::create([ |
@@ -190,6 +190,6 @@ discard block |
||
190 | 190 | |
191 | 191 | private function getRepository($bucketable) |
192 | 192 | { |
193 | - return app(config('twill.namespace')."\Repositories\\".ucfirst(str_singular($bucketable)).'Repository'); |
|
193 | + return app(config('twill.namespace') . "\Repositories\\" . ucfirst(str_singular($bucketable)) . 'Repository'); |
|
194 | 194 | } |
195 | 195 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $items = $this->getIndexItems($scopes); |
51 | 51 | |
52 | 52 | return [ |
53 | - 'items' => $items->map(function ($item) { |
|
53 | + 'items' => $items->map(function($item) { |
|
54 | 54 | return $this->buildFile($item); |
55 | 55 | })->toArray(), |
56 | 56 | 'maxPage' => $items->lastPage(), |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | private function buildFile($item) |
63 | 63 | { |
64 | 64 | return $item->toCmsArray() + [ |
65 | - 'tags' => $item->tags->map(function ($tag) { |
|
65 | + 'tags' => $item->tags->map(function($tag) { |
|
66 | 66 | return $tag->name; |
67 | 67 | }), |
68 | 68 | 'deleteUrl' => $item->canDeleteSafely() ? moduleRoute($this->moduleName, $this->routePrefix, 'destroy', $item->id) : null, |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | $filename = $request->input('qqfilename'); |
104 | 104 | $cleanFilename = preg_replace("/\s+/i", '-', $filename); |
105 | 105 | |
106 | - $fileDirectory = public_path(config('twill.file_library.local_path').$request->input('unique_folder_name')); |
|
106 | + $fileDirectory = public_path(config('twill.file_library.local_path') . $request->input('unique_folder_name')); |
|
107 | 107 | |
108 | 108 | $request->file('qqfile')->move($fileDirectory, $cleanFilename); |
109 | 109 | |
110 | 110 | $fields = [ |
111 | - 'uuid' => $request->input('unique_folder_name').'/'.$cleanFilename, |
|
111 | + 'uuid' => $request->input('unique_folder_name') . '/' . $cleanFilename, |
|
112 | 112 | 'filename' => $cleanFilename, |
113 | 113 | 'size' => $request->input('qqtotalfilesize'), |
114 | 114 | ]; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $items = $this->getIndexItems($scopes); |
152 | 152 | |
153 | 153 | return response()->json([ |
154 | - 'items' => $items->map(function ($item) { |
|
154 | + 'items' => $items->map(function($item) { |
|
155 | 155 | return $this->buildFile($item); |
156 | 156 | })->toArray(), |
157 | 157 | 'tags' => $this->repository->getTagsList(), |
@@ -11,13 +11,13 @@ |
||
11 | 11 | |
12 | 12 | public function view($view) |
13 | 13 | { |
14 | - return view('templates.'.$view); |
|
14 | + return view('templates.' . $view); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | public function xhr($view) |
18 | 18 | { |
19 | 19 | $response = [ |
20 | - 'data' => view('templates.'.$view)->render(), |
|
20 | + 'data' => view('templates.' . $view)->render(), |
|
21 | 21 | 'has_more' => (rand(0, 10) > 5), |
22 | 22 | ]; |
23 | 23 |
@@ -35,16 +35,16 @@ discard block |
||
35 | 35 | |
36 | 36 | $blocksCollection->push($newBlock); |
37 | 37 | |
38 | - $block['blocks']->each(function ($childBlock) use ($newBlock, $blocksCollection, $blockRepository) { |
|
38 | + $block['blocks']->each(function($childBlock) use ($newBlock, $blocksCollection, $blockRepository) { |
|
39 | 39 | $childBlock['parent_id'] = $newBlock->id; |
40 | 40 | $newChildBlock = $blockRepository->createForPreview($childBlock); |
41 | 41 | $blocksCollection->push($newChildBlock); |
42 | 42 | }); |
43 | 43 | |
44 | - $renderedBlocks = $blocksCollection->where('parent_id', null)->map(function ($block) use ($blocksCollection) { |
|
44 | + $renderedBlocks = $blocksCollection->where('parent_id', null)->map(function($block) use ($blocksCollection) { |
|
45 | 45 | if (config('twill.block_editor.block_preview_render_childs') ?? true) { |
46 | 46 | $childBlocks = $blocksCollection->where('parent_id', $block->id); |
47 | - $renderedChildViews = $childBlocks->map(function ($childBlock) { |
|
47 | + $renderedChildViews = $childBlocks->map(function($childBlock) { |
|
48 | 48 | $view = $this->getBlockView($childBlock->type); |
49 | 49 | |
50 | 50 | return view($view)->with('block', $childBlock)->render(); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | $view = $this->getBlockView($block->type); |
57 | 57 | |
58 | - return view($view)->with('block', $block)->render().($renderedChildViews ?? ''); |
|
58 | + return view($view)->with('block', $block)->render() . ($renderedChildViews ?? ''); |
|
59 | 59 | })->implode(''); |
60 | 60 | |
61 | 61 | $view = view(config('twill.block_editor.block_single_layout')); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | private function getBlockView($blockType) |
69 | 69 | { |
70 | - $view = config('twill.block_editor.block_views_path').'.'.$blockType; |
|
70 | + $view = config('twill.block_editor.block_views_path') . '.' . $blockType; |
|
71 | 71 | |
72 | 72 | $customViews = config('twill.block_editor.block_views_mappings'); |
73 | 73 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $items = $this->getIndexItems($scopes); |
51 | 51 | |
52 | 52 | return [ |
53 | - 'items' => $items->map(function ($item) { |
|
53 | + 'items' => $items->map(function($item) { |
|
54 | 54 | return $this->buildMedia($item); |
55 | 55 | })->toArray(), |
56 | 56 | 'maxPage' => $items->lastPage(), |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | private function buildMedia($item) |
63 | 63 | { |
64 | 64 | return $item->toCmsArray() + [ |
65 | - 'tags' => $item->tags->map(function ($tag) { |
|
65 | + 'tags' => $item->tags->map(function($tag) { |
|
66 | 66 | return $tag->name; |
67 | 67 | }), |
68 | 68 | 'deleteUrl' => $item->canDeleteSafely() ? moduleRoute($this->moduleName, $this->routePrefix, 'destroy', $item->id) : null, |
@@ -116,14 +116,14 @@ discard block |
||
116 | 116 | |
117 | 117 | $filename = sanitizeFilename($originalFilename); |
118 | 118 | |
119 | - $fileDirectory = public_path(config('twill.media_library.local_path').$request->input('unique_folder_name')); |
|
119 | + $fileDirectory = public_path(config('twill.media_library.local_path') . $request->input('unique_folder_name')); |
|
120 | 120 | |
121 | 121 | $request->file('qqfile')->move($fileDirectory, $filename); |
122 | 122 | |
123 | - list($w, $h) = getimagesize($fileDirectory.'/'.$filename); |
|
123 | + list($w, $h) = getimagesize($fileDirectory . '/' . $filename); |
|
124 | 124 | |
125 | 125 | $fields = [ |
126 | - 'uuid' => config('twill.media_library.local_path').$request->input('unique_folder_name').'/'.$filename, |
|
126 | + 'uuid' => config('twill.media_library.local_path') . $request->input('unique_folder_name') . '/' . $filename, |
|
127 | 127 | 'filename' => $originalFilename, |
128 | 128 | 'width' => $w, |
129 | 129 | 'height' => $h, |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $items = $this->getIndexItems($scopes); |
172 | 172 | |
173 | 173 | return response()->json([ |
174 | - 'items' => $items->map(function ($item) { |
|
174 | + 'items' => $items->map(function($item) { |
|
175 | 175 | return $this->buildMedia($item); |
176 | 176 | })->toArray(), |
177 | 177 | 'tags' => $this->repository->getTagsList(), |
@@ -15,10 +15,10 @@ |
||
15 | 15 | |
16 | 16 | public function index($section) |
17 | 17 | { |
18 | - return view()->exists('admin.settings.'.$section) ? view('admin.settings.'.$section, [ |
|
18 | + return view()->exists('admin.settings.' . $section) ? view('admin.settings.' . $section, [ |
|
19 | 19 | 'customForm' => true, |
20 | 20 | 'editableTitle' => false, |
21 | - 'customTitle' => ucfirst($section).' settings', |
|
21 | + 'customTitle' => ucfirst($section) . ' settings', |
|
22 | 22 | 'section' => $section, |
23 | 23 | 'form_fields' => $this->settings->getFormFields($section), |
24 | 24 | 'saveUrl' => route('admin.settings.update', $section), |
@@ -15,17 +15,17 @@ |
||
15 | 15 | } |
16 | 16 | |
17 | 17 | if (!isset($this->showViewName)) { |
18 | - $this->showViewName = 'site.'.str_singular($this->moduleName); |
|
18 | + $this->showViewName = 'site.' . str_singular($this->moduleName); |
|
19 | 19 | } |
20 | 20 | |
21 | - if (ends_with(request()->route()->getName(), $this->routeName.'.preview')) { |
|
21 | + if (ends_with(request()->route()->getName(), $this->routeName . '.preview')) { |
|
22 | 22 | $item = $this->getItemPreview($slug); |
23 | 23 | } |
24 | 24 | |
25 | - abort_unless($item = ($item ?? $this->getItem($slug)), 404, ucfirst($this->moduleName).' not found'); |
|
25 | + abort_unless($item = ($item ?? $this->getItem($slug)), 404, ucfirst($this->moduleName) . ' not found'); |
|
26 | 26 | |
27 | 27 | if ($item->redirect) { |
28 | - return redirect()->to(route($this->routeName.'.show', $item->getSlug())); |
|
28 | + return redirect()->to(route($this->routeName . '.show', $item->getSlug())); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | return view($this->showViewName, [ |
@@ -17,9 +17,9 @@ |
||
17 | 17 | 'endpoint' => $endpointType === 'local' ? route('admin.media-library.medias.store') : s3Endpoint($libraryDisk), |
18 | 18 | 'successEndpoint' => route('admin.media-library.medias.store'), |
19 | 19 | 'signatureEndpoint' => route('admin.media-library.sign-s3-upload'), |
20 | - 'endpointBucket' => config('filesystems.disks.'.$libraryDisk.'.bucket', 'none'), |
|
21 | - 'endpointRegion' => config('filesystems.disks.'.$libraryDisk.'.region', 'none'), |
|
22 | - 'accessKey' => config('filesystems.disks.'.$libraryDisk.'.key', 'none'), |
|
20 | + 'endpointBucket' => config('filesystems.disks.' . $libraryDisk . '.bucket', 'none'), |
|
21 | + 'endpointRegion' => config('filesystems.disks.' . $libraryDisk . '.region', 'none'), |
|
22 | + 'accessKey' => config('filesystems.disks.' . $libraryDisk . '.key', 'none'), |
|
23 | 23 | 'csrfToken' => csrf_token(), |
24 | 24 | 'acl' => config('twill.media_library.acl'), |
25 | 25 | 'filesizeLimit' => config('twill.media_library.filesize_limit'), |