@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $files = collect(); |
25 | 25 | |
26 | 26 | foreach ($paths as $path) { |
27 | - if (! $fullpath = self::constructFullPath($path)) { |
|
27 | + if (!$fullpath = self::constructFullPath($path)) { |
|
28 | 28 | continue; |
29 | 29 | } |
30 | 30 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | - return static::$loadedSnippets = new self($files->map(function (SplFileInfo $file) { |
|
39 | + return static::$loadedSnippets = new self($files->map(function(SplFileInfo $file) { |
|
40 | 40 | $path = $file->getRealPath(); |
41 | 41 | |
42 | 42 | if (0 === strpos($path, resource_path('views')) && false !== strpos($file->getBasename(), '.blade.php')) { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | $key = substr($file->getBasename(), 0, strpos($file->getBasename(), '.')); |
47 | - $label = ucfirst(str_replace(['-','_'], ' ', $key)); |
|
47 | + $label = ucfirst(str_replace(['-', '_'], ' ', $key)); |
|
48 | 48 | |
49 | 49 | return new Snippet($key, $label, $path); |
50 | 50 | })->all()); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | $loadedSnippets = static::load(); |
56 | 56 | |
57 | - return $loadedSnippets->first(function (Snippet $snippet) use ($key) { |
|
57 | + return $loadedSnippets->first(function(Snippet $snippet) use ($key) { |
|
58 | 58 | return $snippet->key() == $key; |
59 | 59 | }); |
60 | 60 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | public function toClips(): array |
87 | 87 | { |
88 | - return $this->map(function ($snippet) { |
|
88 | + return $this->map(function($snippet) { |
|
89 | 89 | return [$snippet->label(), $snippet->placeholder()]; |
90 | 90 | })->toArray(); |
91 | 91 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | // Mark the slug as deleted to avoid any conflict with newly created modules with the same slug. |
32 | 32 | if ($model instanceof Module) { |
33 | 33 | $model->update([ |
34 | - 'slug' => $model->slug . $this->appendDeleteMarker(), |
|
34 | + 'slug' => $model->slug.$this->appendDeleteMarker(), |
|
35 | 35 | ]); |
36 | 36 | } |
37 | 37 | |
@@ -58,6 +58,6 @@ discard block |
||
58 | 58 | |
59 | 59 | private function appendDeleteMarker(): string |
60 | 60 | { |
61 | - return '_DELETED_' . time(); |
|
61 | + return '_DELETED_'.time(); |
|
62 | 62 | } |
63 | 63 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | public function findAllArchived(): Collection |
51 | 51 | { |
52 | - return $this->manager->modelInstance()::archived()->get()->map(function ($model) { |
|
52 | + return $this->manager->modelInstance()::archived()->get()->map(function($model) { |
|
53 | 53 | return $this->managers->findByModel($model); |
54 | 54 | }); |
55 | 55 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | public function route($verb): ?string |
58 | 58 | { |
59 | 59 | $routes = [ |
60 | - 'index' => route('chief.back.assistants.view', [$this->key(),'index', $this->manager->managerKey()]), |
|
60 | + 'index' => route('chief.back.assistants.view', [$this->key(), 'index', $this->manager->managerKey()]), |
|
61 | 61 | ]; |
62 | 62 | |
63 | 63 | if (array_key_exists($verb, $routes)) { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | throw new \InvalidArgumentException('ArchiveAssistant requires the model to implement the StatefulContract. ['.get_class($this->manager->existingModel()).'] given instead.'); |
84 | 84 | } |
85 | 85 | |
86 | - if (! $this->can($verb)) { |
|
86 | + if (!$this->can($verb)) { |
|
87 | 87 | NotAllowedManagerRoute::notAllowedVerb($verb, $this->manager); |
88 | 88 | } |
89 | 89 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | // Ok now get all urls from this model and point them to the new records |
112 | 112 | foreach (UrlRecord::getByModel($this->manager->existingModel()) as $urlRecord) { |
113 | - if ($targetRecord = $targetRecords->first(function ($record) use ($urlRecord) { |
|
113 | + if ($targetRecord = $targetRecords->first(function($record) use ($urlRecord) { |
|
114 | 114 | return ($record->locale == $urlRecord->locale && !$record->isRedirect()); |
115 | 115 | })) { |
116 | 116 | $urlRecord->redirectTo($targetRecord); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | ->performedOn($this->manager->existingModel()) |
128 | 128 | ->log('archived'); |
129 | 129 | |
130 | - return redirect()->to($this->manager->route('index'))->with('messages.success', $this->manager->details()->title .' is gearchiveerd.'); |
|
130 | + return redirect()->to($this->manager->route('index'))->with('messages.success', $this->manager->details()->title.' is gearchiveerd.'); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | public function unarchive() |
@@ -143,6 +143,6 @@ discard block |
||
143 | 143 | ->performedOn($this->manager->existingModel()) |
144 | 144 | ->log('unarchived'); |
145 | 145 | |
146 | - return redirect()->to($this->manager->route('index'))->with('messages.success', $this->manager->details()->title .' is hersteld.'); |
|
146 | + return redirect()->to($this->manager->route('index'))->with('messages.success', $this->manager->details()->title.' is hersteld.'); |
|
147 | 147 | } |
148 | 148 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | try { |
17 | 17 | DB::beginTransaction(); |
18 | 18 | |
19 | - $invitation = Invitation::make((string) $invitee->id, (string) $inviter->id); |
|
19 | + $invitation = Invitation::make((string)$invitee->id, (string)$inviter->id); |
|
20 | 20 | |
21 | 21 | InvitationState::make($invitation)->apply('invite'); |
22 | 22 |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | ->performedOn($this->manager->existingModel()) |
60 | 60 | ->log('published'); |
61 | 61 | |
62 | - return redirect()->to($this->manager->route('edit'))->with('messages.success', $this->manager->details()->title . ' is online gezet.'); |
|
62 | + return redirect()->to($this->manager->route('edit'))->with('messages.success', $this->manager->details()->title.' is online gezet.'); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | public function unpublish() |
@@ -73,12 +73,12 @@ discard block |
||
73 | 73 | ->performedOn($this->manager->existingModel()) |
74 | 74 | ->log('unpublished'); |
75 | 75 | |
76 | - return redirect()->to($this->manager->route('edit'))->with('messages.success', $this->manager->details()->title . ' is offline gehaald.'); |
|
76 | + return redirect()->to($this->manager->route('edit'))->with('messages.success', $this->manager->details()->title.' is offline gehaald.'); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | public function findAll(): Collection |
80 | 80 | { |
81 | - return $this->manager->existingModel()->published()->get()->map(function ($model) { |
|
81 | + return $this->manager->existingModel()->published()->get()->map(function($model) { |
|
82 | 82 | return $this->managers->findByModel($model); |
83 | 83 | }); |
84 | 84 | } |
@@ -129,10 +129,10 @@ discard block |
||
129 | 129 | $class = 'text-warning'; |
130 | 130 | } |
131 | 131 | |
132 | - $statusAsLabel = '<span class="' . $class . '">' . $label . '</span>'; |
|
132 | + $statusAsLabel = '<span class="'.$class.'">'.$label.'</span>'; |
|
133 | 133 | |
134 | 134 | if (!$plain && $this->hasPreviewUrl()) { |
135 | - $statusAsLabel = '<a href="' . $this->previewUrl() . '" target="_blank">' . $statusAsLabel . '</a>'; |
|
135 | + $statusAsLabel = '<a href="'.$this->previewUrl().'" target="_blank">'.$statusAsLabel.'</a>'; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | return $statusAsLabel; |
@@ -38,7 +38,7 @@ |
||
38 | 38 | return $closure($this->validatorFactory, $data); |
39 | 39 | } |
40 | 40 | |
41 | - if($field->ofType(FieldType::MEDIA)) { |
|
41 | + if ($field->ofType(FieldType::MEDIA)) { |
|
42 | 42 | $this->validatorFactory->resolver($this->container->make(MediaValidatorResolver::class)->resolvingClosure()); |
43 | 43 | |
44 | 44 | return $this->validatorFactory->make($data, |
@@ -6,26 +6,26 @@ discard block |
||
6 | 6 | { |
7 | 7 | public function validate($attribute, $value, $params, $validator): bool |
8 | 8 | { |
9 | - if(!$file = $this->retrieveFileFromRequest($attribute, $validator->attributes())) { |
|
9 | + if (!$file = $this->retrieveFileFromRequest($attribute, $validator->attributes())) { |
|
10 | 10 | return false; |
11 | 11 | } |
12 | 12 | trap($file); |
13 | - if(!$value) return false; |
|
13 | + if (!$value) return false; |
|
14 | 14 | |
15 | 15 | trap($attribute, $value, $params); |
16 | 16 | return false; |
17 | - if(!isset($validator->attributes()['files'])) return false; |
|
18 | - if(!isset($validator->attributes()['files'][$attribute])) return false; |
|
17 | + if (!isset($validator->attributes()['files'])) return false; |
|
18 | + if (!isset($validator->attributes()['files'][$attribute])) return false; |
|
19 | 19 | |
20 | 20 | $values = $validator->attributes()['files'][$attribute]; |
21 | 21 | |
22 | - foreach($values as $locale => $value) |
|
22 | + foreach ($values as $locale => $value) |
|
23 | 23 | { |
24 | 24 | $new = isset($value['new']) ? count($value['new']) : 0; |
25 | 25 | $replace = isset($value['replace']) ? count($value['replace']) : 0; |
26 | 26 | $delete = isset($value['delete']) ? count($value['delete']) : 0; |
27 | 27 | |
28 | - if ($new + $replace - $delete > 0) { |
|
28 | + if ($new+$replace-$delete > 0) { |
|
29 | 29 | return true; |
30 | 30 | } |
31 | 31 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | trap($values['files'][$attribute]); |
39 | 39 | |
40 | - if(!isset($values['files'], $values['files'][$attribute])) return null; |
|
40 | + if (!isset($values['files'], $values['files'][$attribute])) return null; |
|
41 | 41 | |
42 | 42 | return $values['files'][$attribute]; |
43 | 43 | } |
@@ -10,12 +10,18 @@ discard block |
||
10 | 10 | return false; |
11 | 11 | } |
12 | 12 | trap($file); |
13 | - if(!$value) return false; |
|
13 | + if(!$value) { |
|
14 | + return false; |
|
15 | + } |
|
14 | 16 | |
15 | 17 | trap($attribute, $value, $params); |
16 | 18 | return false; |
17 | - if(!isset($validator->attributes()['files'])) return false; |
|
18 | - if(!isset($validator->attributes()['files'][$attribute])) return false; |
|
19 | + if(!isset($validator->attributes()['files'])) { |
|
20 | + return false; |
|
21 | + } |
|
22 | + if(!isset($validator->attributes()['files'][$attribute])) { |
|
23 | + return false; |
|
24 | + } |
|
19 | 25 | |
20 | 26 | $values = $validator->attributes()['files'][$attribute]; |
21 | 27 | |
@@ -37,7 +43,9 @@ discard block |
||
37 | 43 | { |
38 | 44 | trap($values['files'][$attribute]); |
39 | 45 | |
40 | - if(!isset($values['files'], $values['files'][$attribute])) return null; |
|
46 | + if(!isset($values['files'], $values['files'][$attribute])) { |
|
47 | + return null; |
|
48 | + } |
|
41 | 49 | |
42 | 50 | return $values['files'][$attribute]; |
43 | 51 | } |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | public function add(HasAsset $model, $value, string $locale, string $type, array $metadata = []): Asset |
27 | 27 | { |
28 | 28 | /** @var AssetProcedure $procedure */ |
29 | - foreach($this->procedures as $procedure){ |
|
30 | - if($procedure->applicable($value)) { |
|
29 | + foreach ($this->procedures as $procedure) { |
|
30 | + if ($procedure->applicable($value)) { |
|
31 | 31 | return $procedure->add($model, $value, $locale, $type, $metadata); |
32 | 32 | } |
33 | 33 | } |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | public function replace(HasAsset $model, string $currentAssetId, $value, string $locale, string $type, array $metadata = []): Asset |
39 | 39 | { |
40 | 40 | /** @var AssetProcedure $procedure */ |
41 | - foreach($this->procedures as $procedure){ |
|
42 | - if($procedure->applicable($value)) { |
|
41 | + foreach ($this->procedures as $procedure) { |
|
42 | + if ($procedure->applicable($value)) { |
|
43 | 43 | $asset = $procedure->add($model, $value, $locale, $type, $metadata); |
44 | 44 | |
45 | 45 | $this->replaceAsset->handle($model, $currentAssetId, $asset->id); |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare(strict_types = 1); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace Thinktomorrow\Chief\Fields\Types; |
4 | 4 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | return $request->input($this->dottedName()); |
21 | 21 | } |
22 | 22 | |
23 | - public function save( Request $request) |
|
23 | + public function save(Request $request) |
|
24 | 24 | { |
25 | 25 | |
26 | 26 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $images = []; |
31 | 31 | $locale = $locale ?? app()->getLocale(); |
32 | 32 | |
33 | - $assets = $model->assetRelation->where('pivot.type', $this->key())->filter(function ($asset) use ($locale) { |
|
33 | + $assets = $model->assetRelation->where('pivot.type', $this->key())->filter(function($asset) use ($locale) { |
|
34 | 34 | return $asset->pivot->locale == $locale; |
35 | 35 | })->sortBy('pivot.order'); |
36 | 36 |