Test Setup Failed
Push — a-simpler-manager ( cfc0f9...c7b435 )
by Ben
06:32
created
src/PageBuilder/PageBuilder.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace Thinktomorrow\Chief\PageBuilder;
6 6
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         $availableChildren = AvailableChildren::forParent($model);
43 43
 
44 44
         // Only include modules of this model or shared ones.
45
-        $modules = $availableChildren->onlyModules()->reject(function ($module) use ($model) {
45
+        $modules = $availableChildren->onlyModules()->reject(function($module) use ($model) {
46 46
             return $module->owner_id != null && $module->owner_id != $model->id;
47 47
         });
48 48
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         $available_sets = FlatReferencePresenter::toGroupedSelectValues($availableChildren->onlySets())->toArray();
52 52
 
53 53
         // Current sections
54
-        $sections = $model->children()->map(function ($section, $index) use($model) {
54
+        $sections = $model->children()->map(function($section, $index) use($model) {
55 55
 //            if ($section instanceof TranslatableContract) {
56 56
 //
57 57
 //            }
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
         $trans = [];
89 89
 
90 90
         // Has dynamic attributes
91
-        if(public_method_exists($model, 'dynamic')) {
91
+        if (public_method_exists($model, 'dynamic')) {
92 92
             foreach (config('thinktomorrow.chief.locales') as $locale) {
93 93
                 $trans[$locale] = [];
94 94
 
95
-                foreach($model->rawDynamicValues() as $key => $values) {
96
-                    if(is_array($values)) {
97
-                        foreach($values as $dynamicLocale => $dynamicValue) {
98
-                            if($dynamicLocale === $locale) {
95
+                foreach ($model->rawDynamicValues() as $key => $values) {
96
+                    if (is_array($values)) {
97
+                        foreach ($values as $dynamicLocale => $dynamicValue) {
98
+                            if ($dynamicLocale === $locale) {
99 99
                                 $trans[$locale][$key] = $dynamicValue;
100 100
                             }
101 101
                         }
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
         }
106 106
 
107 107
         // Astrotomic translatable
108
-        if($model instanceof Translatable) {
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])) $trans[$locale] = [];
111 111
 
112 112
                 $trans[$locale] = array_merge($trans[$locale], $model->getTranslation($locale)->toArray());
113 113
             }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,9 @@
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
src/PageBuilder/Relations/AvailableChildren.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
 
37 37
     public function onlyModules(): Collection
38 38
     {
39
-        return $this->collection()->reject(function ($item) {
39
+        return $this->collection()->reject(function($item) {
40 40
             return ($item instanceof ActsAsParent);
41 41
         });
42 42
     }
43 43
 
44 44
     public function onlyPages(): Collection
45 45
     {
46
-        return $this->collection()->filter(function ($item) {
46
+        return $this->collection()->filter(function($item) {
47 47
             return ($item instanceof ActsAsParent);
48 48
         });
49 49
     }
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 //        }
99 99
 
100 100
         // Remove duplicate models
101
-        $collection = $collection->unique(function ($model) {
101
+        $collection = $collection->unique(function($model) {
102 102
             return (new FlatReference(get_class($model), $model->id))->get();
103 103
         });
104 104
 
105 105
         // Filter out our parent
106
-        return $this->collection = $collection->reject(function ($item) {
106
+        return $this->collection = $collection->reject(function($item) {
107 107
             return ($item instanceof $this->parent && $item->id == $this->parent->id);
108 108
         })->values();
109 109
     }
Please login to merge, or discard this patch.
src/Managers/Assistants/CrudAssistant.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -95,15 +95,15 @@  discard block
 block discarded – undo
95 95
         // Default sorted by publish date
96 96
         $modelClass = static::managedModelClass();
97 97
         if (Schema::hasColumn((new $modelClass)->getTable(), 'published_at')) {
98
-            $filters = $filters->add(HiddenFilter::make('publish', function($query){
99
-                return $query->orderBy('published_at','DESC');
98
+            $filters = $filters->add(HiddenFilter::make('publish', function($query) {
99
+                return $query->orderBy('published_at', 'DESC');
100 100
             }));
101 101
         }
102 102
 
103 103
         // if model has no timestamps, updated_at doesn't exist
104 104
         if ((new $modelClass)->timestamps) {
105
-            $filters = $filters->add(HiddenFilter::make('updated', function($query){
106
-                return $query->orderBy('updated_at','DESC');
105
+            $filters = $filters->add(HiddenFilter::make('updated', function($query) {
106
+                return $query->orderBy('updated_at', 'DESC');
107 107
             }));
108 108
         }
109 109
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         $model->saveFields($model->fields()->tagged('create'), $request->all(), $request->allFiles());
135 135
 
136 136
         return redirect()->to($this->route('edit', $model))
137
-            ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i>  "' . $model->adminLabel('title') . '" is toegevoegd');
137
+            ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i>  "'.$model->adminLabel('title').'" is toegevoegd');
138 138
     }
139 139
 
140 140
     public function edit($id)
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         return view('chief::back.managers.edit', [
150 150
             'manager'    => $this,
151 151
             'model'      => $model,
152
-            'fields'     => $model->fields()->map(function (Field $field) use ($model) {
152
+            'fields'     => $model->fields()->map(function(Field $field) use ($model) {
153 153
                 // TODO refactor so render method of field takes model and managerViewModel as arguments.
154 154
                 return $field->model($model)
155 155
                              ->viewData(['managerViewModel' => new managerViewModel($this)]);
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         $model->saveFields($model->fields(), $request->all(), $request->allFiles());
170 170
 
171 171
         return redirect()->to($this->route('index'))
172
-            ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i>  <a href="'. $this->route('edit',$model) .'">' . $model->adminLabel('title') . '</a> is aangepast');
172
+            ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i>  <a href="'.$this->route('edit', $model).'">'.$model->adminLabel('title').'</a> is aangepast');
173 173
     }
174 174
 
175 175
     public function delete($id, Request $request)
@@ -179,12 +179,12 @@  discard block
 block discarded – undo
179 179
         $model = static::managedModelClass()::findOrFail($id);
180 180
 
181 181
         if ($request->get('deleteconfirmation') !== 'DELETE') {
182
-            return redirect()->back()->with('messages.warning', $model->adminLabel('title') . ' is niet verwijderd.');
182
+            return redirect()->back()->with('messages.warning', $model->adminLabel('title').' is niet verwijderd.');
183 183
         }
184 184
 
185 185
         app(DeleteManagedModel::class)->handle($model);
186 186
 
187 187
         return redirect()->to($this->route('index'))
188
-            ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i>  "' . $model->adminLabel('title') . '" is verwijderd.');
188
+            ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i>  "'.$model->adminLabel('title').'" is verwijderd.');
189 189
     }
190 190
 }
Please login to merge, or discard this patch.