@@ -27,7 +27,9 @@ discard block |
||
27 | 27 | |
28 | 28 | public function canArchiveAssistant(string $action, $model = null): bool |
29 | 29 | { |
30 | - if(!in_array($action, ['archive', 'unarchive', 'archive_index'])) return false; |
|
30 | + if(!in_array($action, ['archive', 'unarchive', 'archive_index'])) { |
|
31 | + return false; |
|
32 | + } |
|
31 | 33 | |
32 | 34 | if($action === 'archive_index') { |
33 | 35 | // Archive index is only visitable when there is at least one model archived. |
@@ -37,7 +39,9 @@ discard block |
||
37 | 39 | return false; |
38 | 40 | } |
39 | 41 | |
40 | - if(!$model || !$model instanceof StatefulContract) return false; |
|
42 | + if(!$model || !$model instanceof StatefulContract) { |
|
43 | + return false; |
|
44 | + } |
|
41 | 45 | |
42 | 46 | return PageState::make($model)->can($action); |
43 | 47 | } |
@@ -24,16 +24,22 @@ |
||
24 | 24 | |
25 | 25 | public function routePublishAssistant(string $action, $model = null, ...$parameters): ?string |
26 | 26 | { |
27 | - if(!$this->canPublishAssistant($action, $model)) return null; |
|
27 | + if(!$this->canPublishAssistant($action, $model)) { |
|
28 | + return null; |
|
29 | + } |
|
28 | 30 | |
29 | 31 | return $this->generateRoute($action, $model, ...$parameters); |
30 | 32 | } |
31 | 33 | |
32 | 34 | public function canPublishAssistant(string $action, $model = null): bool |
33 | 35 | { |
34 | - if(!in_array($action, ['publish', 'unpublish'])) return false; |
|
36 | + if(!in_array($action, ['publish', 'unpublish'])) { |
|
37 | + return false; |
|
38 | + } |
|
35 | 39 | |
36 | - if(!$model || !$model instanceof StatefulContract) return false; |
|
40 | + if(!$model || !$model instanceof StatefulContract) { |
|
41 | + return false; |
|
42 | + } |
|
37 | 43 | |
38 | 44 | return PageState::make($model)->can($action); |
39 | 45 | } |
@@ -9,7 +9,9 @@ discard block |
||
9 | 9 | { |
10 | 10 | public function canPreviewAssistant(string $action, $model = null): bool |
11 | 11 | { |
12 | - if($action !== 'preview' || !$model) return false; |
|
12 | + if($action !== 'preview' || !$model) { |
|
13 | + return false; |
|
14 | + } |
|
13 | 15 | |
14 | 16 | return $model instanceof ProvidesUrl; |
15 | 17 | } |
@@ -27,7 +29,9 @@ discard block |
||
27 | 29 | */ |
28 | 30 | public function routePreviewAssistant(string $action, $model = null, ...$parameters): ?string |
29 | 31 | { |
30 | - if(!$this->canPreviewAssistant($action, $model)) return null; |
|
32 | + if(!$this->canPreviewAssistant($action, $model)) { |
|
33 | + return null; |
|
34 | + } |
|
31 | 35 | |
32 | 36 | return $model->url(); |
33 | 37 | } |
@@ -45,7 +45,9 @@ |
||
45 | 45 | // Dynamic localized values or standard translated |
46 | 46 | // For standard translations we set value with the colon notation, e.g. title:en |
47 | 47 | $this->foreachTranslationEntry(data_get($input, 'trans', []), function($locale, $key, $value) use($field){ |
48 | - if($key !== $field->getColumn()) return; |
|
48 | + if($key !== $field->getColumn()) { |
|
49 | + return; |
|
50 | + } |
|
49 | 51 | |
50 | 52 | if($this->isFieldForDynamicValue($field)) { |
51 | 53 | $this->setDynamic($key, $value, $locale); |
@@ -31,7 +31,9 @@ |
||
31 | 31 | |
32 | 32 | public function routeModuleCrudAssistant(string $action, $model = null, ...$parameters): ?string |
33 | 33 | { |
34 | - if(!in_array($action, ['create','store'])) return null; |
|
34 | + if(!in_array($action, ['create','store'])) { |
|
35 | + return null; |
|
36 | + } |
|
35 | 37 | |
36 | 38 | return $this->generateRoute($action, $model, ... $parameters); |
37 | 39 | } |
@@ -44,7 +44,9 @@ |
||
44 | 44 | |
45 | 45 | private function statusAsLabel(): string |
46 | 46 | { |
47 | - if(!$this instanceof ProvidesUrl) return ''; |
|
47 | + if(!$this instanceof ProvidesUrl) { |
|
48 | + return ''; |
|
49 | + } |
|
48 | 50 | |
49 | 51 | if ($this->current_status === PageState::PUBLISHED) { |
50 | 52 | return '<a href="' . $this->url() . '" target="_blank"><em>online</em></a>'; |
@@ -46,7 +46,9 @@ |
||
46 | 46 | |
47 | 47 | public function anyRenderable(): bool |
48 | 48 | { |
49 | - if($this->isEmpty()) return false; |
|
49 | + if($this->isEmpty()) { |
|
50 | + return false; |
|
51 | + } |
|
50 | 52 | |
51 | 53 | // If at least one of the filters has content to be rendered. |
52 | 54 | foreach($this->filters as $filter) { |
@@ -107,7 +107,9 @@ |
||
107 | 107 | // Astrotomic translatable |
108 | 108 | if($model instanceof Translatable) { |
109 | 109 | foreach (config('thinktomorrow.chief.locales') as $locale) { |
110 | - if(!isset($trans[$locale])) $trans[$locale] = []; |
|
110 | + if(!isset($trans[$locale])) { |
|
111 | + $trans[$locale] = []; |
|
112 | + } |
|
111 | 113 | |
112 | 114 | $trans[$locale] = array_merge($trans[$locale], $model->getTranslation($locale)->toArray()); |
113 | 115 | } |
@@ -10,14 +10,22 @@ |
||
10 | 10 | { |
11 | 11 | public static function find(array $segments, string $locale = null) |
12 | 12 | { |
13 | - if(count($segments) < 1) return '/'; |
|
14 | - if(count($segments) == 1) return reset($segments); |
|
13 | + if(count($segments) < 1) { |
|
14 | + return '/'; |
|
15 | + } |
|
16 | + if(count($segments) == 1) { |
|
17 | + return reset($segments); |
|
18 | + } |
|
15 | 19 | |
16 | 20 | // Localized value |
17 | - if (($key = $locale ?? app()->getlocale()) && isset($segments[$key])) return $segments[$key]; |
|
21 | + if (($key = $locale ?? app()->getlocale()) && isset($segments[$key])) { |
|
22 | + return $segments[$key]; |
|
23 | + } |
|
18 | 24 | |
19 | 25 | // Fallback localized value |
20 | - if (($fallback_locale = config('app.fallback_locale')) && isset($segments[$fallback_locale])) return $segments[$fallback_locale]; |
|
26 | + if (($fallback_locale = config('app.fallback_locale')) && isset($segments[$fallback_locale])) { |
|
27 | + return $segments[$fallback_locale]; |
|
28 | + } |
|
21 | 29 | |
22 | 30 | // Fallback to first entry |
23 | 31 | return reset($segments); |