@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | // If no view has been created for this page collection, we try once again to fetch the content value if any. This will silently fail |
| 53 | 53 | // if no content value is present. We don't consider the 'content' attribute to be a default as we do for module. |
| 54 | - return $this->map(function ($item) { |
|
| 54 | + return $this->map(function($item) { |
|
| 55 | 55 | return ($this->viewParent && $item instanceof ViewableContract) |
| 56 | 56 | ? $item->setViewParent($this->viewParent)->renderView() |
| 57 | 57 | : ($item->content ?? ''); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $path = request()->path(); |
| 87 | 87 | |
| 88 | 88 | // When we have an entire collection as result we will cut down the items here, else if already paginated, we'll keep it as is. |
| 89 | - $items = $this->comingFromPaginatedCollection() ? $this->all() :array_slice($this->all(), ($currentPage - 1) * $perPage); |
|
| 89 | + $items = $this->comingFromPaginatedCollection() ? $this->all() : array_slice($this->all(), ($currentPage-1) * $perPage); |
|
| 90 | 90 | |
| 91 | 91 | return (new \Illuminate\Pagination\Paginator($items, $perPage ?? $this->paginateSetting('perPage', '12'), $currentPage))->setPath($path); |
| 92 | 92 | } |
@@ -102,10 +102,10 @@ discard block |
||
| 102 | 102 | public function paginate($perPage = null, $currentPage = null): Paginator |
| 103 | 103 | { |
| 104 | 104 | $currentPage = $currentPage ?? request()->get('page', 1); |
| 105 | - $path = '/' . request()->path(); |
|
| 105 | + $path = '/'.request()->path(); |
|
| 106 | 106 | |
| 107 | 107 | // When we have an entire collection as result we will cut down the items here, else if already paginated, we'll keep it as is. |
| 108 | - $items = $this->comingFromPaginatedCollection() ? $this->all() : array_slice($this->all(), ($currentPage - 1) * $perPage, $perPage); |
|
| 108 | + $items = $this->comingFromPaginatedCollection() ? $this->all() : array_slice($this->all(), ($currentPage-1) * $perPage, $perPage); |
|
| 109 | 109 | |
| 110 | 110 | return (new \Illuminate\Pagination\LengthAwarePaginator($items, $this->paginateSetting('total', $this->count()), $perPage ?? $this->paginateSetting('perPage', '12'), $currentPage))->setPath($path); |
| 111 | 111 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | { |
| 11 | 11 | public function onFailure(HealthCheck $healthCheck) |
| 12 | 12 | { |
| 13 | - session()->now($this->generateUniqueSessionKey(), ['type' => 'warning', 'message' => $healthCheck->message() ]); |
|
| 13 | + session()->now($this->generateUniqueSessionKey(), ['type' => 'warning', 'message' => $healthCheck->message()]); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public function onSuccess(HealthCheck $healthCheck) |
@@ -19,10 +19,10 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | private function generateUniqueSessionKey(): string |
| 21 | 21 | { |
| 22 | - $toastId = 'toast_messages.' . mt_rand(0, 9999); |
|
| 22 | + $toastId = 'toast_messages.'.mt_rand(0, 9999); |
|
| 23 | 23 | |
| 24 | 24 | while (session()->get($toastId)) { |
| 25 | - $toastId = 'toast_messages.' . mt_rand(0, 9999); |
|
| 25 | + $toastId = 'toast_messages.'.mt_rand(0, 9999); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | return $toastId; |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | foreach ($notifiers as $notifier) { |
| 33 | 33 | app($notifier)->onFailure($checkInstance); |
| 34 | 34 | } |
| 35 | - } else { |
|
| 35 | + }else { |
|
| 36 | 36 | foreach ($notifiers as $notifier) { |
| 37 | 37 | app($notifier)->onSuccess($checkInstance); |
| 38 | 38 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | foreach ($this->children as $i => $child) { |
| 71 | 71 | |
| 72 | 72 | // Do not render offline relations |
| 73 | - if($child->relation->isOffline()) continue; |
|
| 73 | + if ($child->relation->isOffline()) continue; |
|
| 74 | 74 | |
| 75 | 75 | if ($child instanceof StoredSetReference) { |
| 76 | 76 | $this->addSetToCollection($i, $child->toSet($this->parent)); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $this->addModelToCollection($i, $child); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - return $this->sets->values()->map(function (ViewableContract $child) { |
|
| 98 | + return $this->sets->values()->map(function(ViewableContract $child) { |
|
| 99 | 99 | return ($this->withSnippets && method_exists($child, 'withSnippets')) |
| 100 | 100 | ? $child->withSnippets()->setViewParent($this->parent)->renderView() |
| 101 | 101 | : $child->setViewParent($this->parent)->renderView(); |
@@ -70,7 +70,9 @@ |
||
| 70 | 70 | foreach ($this->children as $i => $child) { |
| 71 | 71 | |
| 72 | 72 | // Do not render offline relations |
| 73 | - if($child->relation->isOffline()) continue; |
|
| 73 | + if($child->relation->isOffline()) { |
|
| 74 | + continue; |
|
| 75 | + } |
|
| 74 | 76 | |
| 75 | 77 | if ($child instanceof StoredSetReference) { |
| 76 | 78 | $this->addSetToCollection($i, $child->toSet($this->parent)); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | $availableChildren = AvailableChildren::forParent($model); |
| 51 | 51 | |
| 52 | - $modules = $availableChildren->onlyModules()->reject(function ($module) use ($model) { |
|
| 52 | + $modules = $availableChildren->onlyModules()->reject(function($module) use ($model) { |
|
| 53 | 53 | return $module->owner_id != null && $module->owner_id != $model->id; |
| 54 | 54 | }); |
| 55 | 55 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $available_sets = FlatReferencePresenter::toGroupedSelectValues($availableChildren->onlySets())->toArray(); |
| 59 | 59 | |
| 60 | 60 | // Current sections |
| 61 | - $sections = $model->children()->map(function ($section, $index) use($model) { |
|
| 61 | + $sections = $model->children()->map(function($section, $index) use($model) { |
|
| 62 | 62 | if ($section instanceof TranslatableContract) { |
| 63 | 63 | $section->injectTranslationForForm(); |
| 64 | 64 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | public static function fromRequest() |
| 19 | 19 | { |
| 20 | - if(!config('thinktomorrow.chief.preview-mode') || Str::startsWith(request()->path(), 'admin/')) { |
|
| 20 | + if (!config('thinktomorrow.chief.preview-mode') || Str::startsWith(request()->path(), 'admin/')) { |
|
| 21 | 21 | return new static(false); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | { |
| 41 | 41 | $mode = config('thinktomorrow.chief.preview-mode'); |
| 42 | 42 | |
| 43 | - if(!$mode || $mode == 'live') return false; |
|
| 43 | + if (!$mode || $mode == 'live') return false; |
|
| 44 | 44 | |
| 45 | 45 | return ($mode == 'preview'); |
| 46 | 46 | } |
@@ -40,7 +40,9 @@ |
||
| 40 | 40 | { |
| 41 | 41 | $mode = config('thinktomorrow.chief.preview-mode'); |
| 42 | 42 | |
| 43 | - if(!$mode || $mode == 'live') return false; |
|
| 43 | + if(!$mode || $mode == 'live') { |
|
| 44 | + return false; |
|
| 45 | + } |
|
| 44 | 46 | |
| 45 | 47 | return ($mode == 'preview'); |
| 46 | 48 | } |