Completed
Pull Request — master (#303)
by Ben
59:09 queued 08:39
created
src/Fields/Types/SelectField.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php declare(strict_types = 1);
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace Thinktomorrow\Chief\Fields\Types;
4 4
 
Please login to merge, or discard this patch.
src/Fields/Types/RangeField.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php declare(strict_types = 1);
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace Thinktomorrow\Chief\Fields\Types;
4 4
 
Please login to merge, or discard this patch.
src/Fields/Types/DateField.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php declare(strict_types = 1);
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace Thinktomorrow\Chief\Fields\Types;
4 4
 
Please login to merge, or discard this patch.
src/Fields/Types/RadioField.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php declare(strict_types = 1);
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace Thinktomorrow\Chief\Fields\Types;
4 4
 
Please login to merge, or discard this patch.
src/Concerns/Sluggable/UniqueSlug.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
         $this->model = $model;
21 21
         $this->blacklist = $blacklist;
22 22
 
23
-        $this->slugResolver = function ($slug) {
23
+        $this->slugResolver = function($slug) {
24 24
             return Str::slug($slug);
25 25
         };
26 26
     }
Please login to merge, or discard this patch.
src/Fields/RenderingFields.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
     public function fieldValue(Field $field, $locale = null)
20 20
     {
21
-        if(!isset($this->model)) return null;
21
+        if (!isset($this->model)) return null;
22 22
 
23 23
         return $field->getFieldValue($this->model, $locale);
24 24
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,9 @@
 block discarded – undo
18 18
 
19 19
     public function fieldValue(Field $field, $locale = null)
20 20
     {
21
-        if(!isset($this->model)) return null;
21
+        if(!isset($this->model)) {
22
+            return null;
23
+        }
22 24
 
23 25
         return $field->getFieldValue($this->model, $locale);
24 26
     }
Please login to merge, or discard this patch.
src/Management/Assistants/ArchiveAssistant.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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)) {
@@ -79,11 +79,11 @@  discard block
 block discarded – undo
79 79
 
80 80
     private function guard($verb): Assistant
81 81
     {
82
-        if(!$this->manager->existingModel() instanceof StatefulContract){
82
+        if (!$this->manager->existingModel() instanceof StatefulContract) {
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
 block discarded – undo
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);
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
         app(ArchiveManagedModel::class)->handle($this->manager->existingModel());
122 122
 
123
-        return redirect()->to($this->manager->route('index'))->with('messages.success', $this->manager->details()->title .' is gearchiveerd.');
123
+        return redirect()->to($this->manager->route('index'))->with('messages.success', $this->manager->details()->title.' is gearchiveerd.');
124 124
     }
125 125
 
126 126
     public function unarchive()
@@ -129,6 +129,6 @@  discard block
 block discarded – undo
129 129
 
130 130
         app(UnArchiveManagedModel::class)->handle($this->manager->existingModel());
131 131
 
132
-        return redirect()->to($this->manager->route('index'))->with('messages.success', $this->manager->details()->title .' is hersteld.');
132
+        return redirect()->to($this->manager->route('index'))->with('messages.success', $this->manager->details()->title.' is hersteld.');
133 133
     }
134 134
 }
Please login to merge, or discard this patch.
src/Management/Exceptions/NotAllowedManagerRoute.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@
 block discarded – undo
39 39
 
40 40
     public static function notAllowedVerb($verb, Manager $manager)
41 41
     {
42
-        throw new self('Not allowed to '.$verb.' a model. '.ucfirst($verb).' route is not allowed by the ' . $manager->details()->key.' manager.');
42
+        throw new self('Not allowed to '.$verb.' a model. '.ucfirst($verb).' route is not allowed by the '.$manager->details()->key.' manager.');
43 43
     }
44 44
 
45 45
     public static function notAllowedPermission($permission, Manager $manager)
46 46
     {
47
-        throw new self('Not allowed permission for '.$permission.' on a model as managed by the ' . $manager->details()->key.' manager.');
47
+        throw new self('Not allowed permission for '.$permission.' on a model as managed by the '.$manager->details()->key.' manager.');
48 48
     }
49 49
 }
Please login to merge, or discard this patch.
src/Management/Application/DeleteManagedModel.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
             DB::beginTransaction();
22 22
 
23 23
             // For stateful transitions we will apply this deletion as a state
24
-            if($model instanceof StatefulContract) {
24
+            if ($model instanceof StatefulContract) {
25 25
                 (new PageState($model, PageState::KEY))->apply('delete');
26 26
                 $model->save();
27 27
             }
@@ -29,17 +29,17 @@  discard block
 block discarded – undo
29 29
             Relation::deleteRelationsOf($model->getMorphClass(), $model->id);
30 30
 
31 31
             // Mark the slug as deleted to avoid any conflict with newly created modules with the same slug.
32
-            if($model instanceof Module) {
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
 
38
-            if($model instanceof ProvidesUrl){
38
+            if ($model instanceof ProvidesUrl) {
39 39
                 UrlRecord::getByModel($model)->each->delete();
40 40
             }
41 41
 
42
-            if($model instanceof Page){
42
+            if ($model instanceof Page) {
43 43
                 Module::where('page_id', $model->id)->delete();
44 44
             }
45 45
 
@@ -58,6 +58,6 @@  discard block
 block discarded – undo
58 58
 
59 59
     private function appendDeleteMarker(): string
60 60
     {
61
-        return '_DELETED_' . time();
61
+        return '_DELETED_'.time();
62 62
     }
63 63
 }
Please login to merge, or discard this patch.