@@ -40,11 +40,11 @@ |
||
| 40 | 40 | |
| 41 | 41 | public static function notAllowedAction($action, string $managerKey) |
| 42 | 42 | { |
| 43 | - return new self('Not allowed to ' . $action . ' a model. ' . ucfirst($action) . ' route is not allowed by the ' . $managerKey . ' manager.'); |
|
| 43 | + return new self('Not allowed to '.$action.' a model. '.ucfirst($action).' route is not allowed by the '.$managerKey.' manager.'); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | public static function notAllowedPermission($permission, string $managerKey) |
| 47 | 47 | { |
| 48 | - return new self('Not allowed permission for ' . $permission . ' on a model as managed by the ' . $managerKey . ' manager.'); |
|
| 48 | + return new self('Not allowed permission for '.$permission.' on a model as managed by the '.$managerKey.' manager.'); |
|
| 49 | 49 | } |
| 50 | 50 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | if ($item->ofType(static::TYPE_INTERNAL) && $page = $item->page) { |
| 105 | 105 | if (public_method_exists($page, 'isArchived') && $page->isArchived()) { |
| 106 | 106 | unset($items[$k]); |
| 107 | - } else { |
|
| 107 | + }else { |
|
| 108 | 108 | $item->url = self::composePageUrl($item, $page); |
| 109 | 109 | $item->page_label = public_method_exists($page, 'menuLabel') ? $page->menuLabel() : ''; |
| 110 | 110 | $item->hidden_in_menu = $page->hidden_in_menu; |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | 'id' => $node->id, |
| 154 | 154 | 'type' => $node->type, |
| 155 | 155 | 'label' => $node->label, |
| 156 | - 'page_label' => $node->page_label, // Extra info when dealing with internal links |
|
| 156 | + 'page_label' => $node->page_label, // Extra info when dealing with internal links |
|
| 157 | 157 | 'url' => $node->url, |
| 158 | 158 | 'order' => $node->order, |
| 159 | 159 | 'page_id' => $node->page_id, |
@@ -36,12 +36,12 @@ discard block |
||
| 36 | 36 | // TODO: how to assign for pagebuilder?? with tag, via the chief relations config or is this default |
| 37 | 37 | $moduleManagerClasses = $this->registeredManagers->tagged('module')->get(); |
| 38 | 38 | |
| 39 | - $managers = collect(array_map(function($moduleManagerClass){ |
|
| 39 | + $managers = collect(array_map(function($moduleManagerClass) { |
|
| 40 | 40 | return app($moduleManagerClass); |
| 41 | 41 | }, $moduleManagerClasses)); |
| 42 | 42 | |
| 43 | 43 | return $managers |
| 44 | - ->reject(function($manager){ return !$manager->can('create'); }) |
|
| 44 | + ->reject(function($manager) { return !$manager->can('create'); }) |
|
| 45 | 45 | ->map(function($manager) use($ownerType, $ownerId){ |
| 46 | 46 | return [ |
| 47 | 47 | 'label' => $manager->adminLabel('page_title'), |
@@ -56,13 +56,13 @@ discard block |
||
| 56 | 56 | // Get the modules that are set to be shareable. |
| 57 | 57 | $moduleManagerClasses = $this->shareableModules(); |
| 58 | 58 | |
| 59 | - $managers = collect(array_map(function($moduleManagerClass){ |
|
| 59 | + $managers = collect(array_map(function($moduleManagerClass) { |
|
| 60 | 60 | return app($moduleManagerClass); |
| 61 | 61 | }, $moduleManagerClasses)); |
| 62 | 62 | |
| 63 | 63 | return $managers |
| 64 | - ->reject(function($manager){ return !$manager->can('create-shared'); }) |
|
| 65 | - ->map(function($manager){ |
|
| 64 | + ->reject(function($manager) { return !$manager->can('create-shared'); }) |
|
| 65 | + ->map(function($manager) { |
|
| 66 | 66 | return [ |
| 67 | 67 | 'label' => $manager->adminLabel('page_title'), |
| 68 | 68 | 'value' => $manager->route('create-shared') |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $model->saveFields($model->fields()->tagged('create'), $request->all(), $request->allFiles()); |
| 92 | 92 | |
| 93 | 93 | return redirect()->to($this->route('edit', $model)) |
| 94 | - ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i> "' . $model->adminLabel('title') . '" is toegevoegd'); |
|
| 94 | + ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i> "'.$model->adminLabel('title').'" is toegevoegd'); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | public function edit($id) |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | return view('chief::back.managers.edit', [ |
| 107 | 107 | 'model' => $model, |
| 108 | 108 | 'managerViewModel' => $this->managerViewModel(), |
| 109 | - 'fields' => $model->fields()->map(function (Field $field) use ($model) { |
|
| 109 | + 'fields' => $model->fields()->map(function(Field $field) use ($model) { |
|
| 110 | 110 | // TODO refactor so render method of field takes model and managerViewModel as arguments. |
| 111 | 111 | return $field->model($model) |
| 112 | 112 | ->viewData(['managerViewModel' => $this->managerViewModel()]); |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $model->saveFields($model->fields(), $request->all(), $request->allFiles()); |
| 127 | 127 | |
| 128 | 128 | return redirect()->to($this->route('edit', $model)) |
| 129 | - ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i> "' . $model->adminLabel('title') . '" is aangepast'); |
|
| 129 | + ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i> "'.$model->adminLabel('title').'" is aangepast'); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | public function delete($id, Request $request) |
@@ -136,12 +136,12 @@ discard block |
||
| 136 | 136 | $model = static::managedModelClass()::findOrFail($id); |
| 137 | 137 | |
| 138 | 138 | if ($request->get('deleteconfirmation') !== 'DELETE') { |
| 139 | - return redirect()->back()->with('messages.warning', $model->adminLabel('title') . ' is niet verwijderd.'); |
|
| 139 | + return redirect()->back()->with('messages.warning', $model->adminLabel('title').' is niet verwijderd.'); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | app(DeleteManagedModel::class)->handle($model); |
| 143 | 143 | |
| 144 | 144 | return redirect()->to($this->route('index')) |
| 145 | - ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i> "' . $model->adminLabel('title') . '" is verwijderd.'); |
|
| 145 | + ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i> "'.$model->adminLabel('title').'" is verwijderd.'); |
|
| 146 | 146 | } |
| 147 | 147 | } |
@@ -159,7 +159,7 @@ |
||
| 159 | 159 | if (is_array_empty($translation)) { |
| 160 | 160 | |
| 161 | 161 | // Nullify all values |
| 162 | - $trans[$locale] = array_map(function ($value) { |
|
| 162 | + $trans[$locale] = array_map(function($value) { |
|
| 163 | 163 | return null; |
| 164 | 164 | }, $translation); |
| 165 | 165 | continue; |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | public function route(string $action, $model = null, ...$parameters): string |
| 28 | 28 | { |
| 29 | - foreach(DiscoverTraitMethods::belongingTo(static::class, 'route') as $method) { |
|
| 30 | - if(null !== ($route = $this->$method($action, $model, ...$parameters))){ |
|
| 29 | + foreach (DiscoverTraitMethods::belongingTo(static::class, 'route') as $method) { |
|
| 30 | + if (null !== ($route = $this->$method($action, $model, ...$parameters))) { |
|
| 31 | 31 | return $route; |
| 32 | 32 | } |
| 33 | 33 | } |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | public function can(string $action, $model = null): bool |
| 42 | 42 | { |
| 43 | - foreach(DiscoverTraitMethods::belongingTo(static::class, 'can') as $method) { |
|
| 44 | - if(true === $this->$method($action, $model)){ |
|
| 43 | + foreach (DiscoverTraitMethods::belongingTo(static::class, 'can') as $method) { |
|
| 44 | + if (true === $this->$method($action, $model)) { |
|
| 45 | 45 | return true; |
| 46 | 46 | } |
| 47 | 47 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $parameters = array_merge((array)$modelId, $parameters); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - return route('chief.' . static::routeKey() . '.' . $action, $parameters); |
|
| 86 | + return route('chief.'.static::routeKey().'.'.$action, $parameters); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | private function guard(string $action) |
@@ -153,7 +153,7 @@ |
||
| 153 | 153 | 'fields' => $model->fields()->map(function (Field $field) use ($model) { |
| 154 | 154 | // TODO refactor so render method of field takes model and managerViewModel as arguments. |
| 155 | 155 | return $field->model($model) |
| 156 | - ->viewData(['managerViewModel' => new managerViewModel($this)]); |
|
| 156 | + ->viewData(['managerViewModel' => new managerViewModel($this)]); |
|
| 157 | 157 | }), |
| 158 | 158 | ]); |
| 159 | 159 | } |
@@ -96,15 +96,15 @@ discard block |
||
| 96 | 96 | // Default sorted by publish date |
| 97 | 97 | $modelClass = static::managedModelClass(); |
| 98 | 98 | if (Schema::hasColumn((new $modelClass)->getTable(), 'published_at')) { |
| 99 | - $filters = $filters->add(HiddenFilter::make('publish', function($query){ |
|
| 100 | - return $query->orderBy('published_at','DESC'); |
|
| 99 | + $filters = $filters->add(HiddenFilter::make('publish', function($query) { |
|
| 100 | + return $query->orderBy('published_at', 'DESC'); |
|
| 101 | 101 | })); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | // if model has no timestamps, updated_at doesn't exist |
| 105 | 105 | if ((new $modelClass)->timestamps) { |
| 106 | - $filters = $filters->add(HiddenFilter::make('updated', function($query){ |
|
| 107 | - return $query->orderBy('updated_at','DESC'); |
|
| 106 | + $filters = $filters->add(HiddenFilter::make('updated', function($query) { |
|
| 107 | + return $query->orderBy('updated_at', 'DESC'); |
|
| 108 | 108 | })); |
| 109 | 109 | } |
| 110 | 110 | |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $model->saveFields($model->fields()->tagged('create'), $request->all(), $request->allFiles()); |
| 136 | 136 | |
| 137 | 137 | return redirect()->to($this->route('edit', $model)) |
| 138 | - ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i> "' . $model->adminLabel('title') . '" is toegevoegd'); |
|
| 138 | + ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i> "'.$model->adminLabel('title').'" is toegevoegd'); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | public function edit($id) |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | return view('chief::back.managers.edit', [ |
| 151 | 151 | 'manager' => $this, |
| 152 | 152 | 'model' => $model, |
| 153 | - 'fields' => $model->fields()->map(function (Field $field) use ($model) { |
|
| 153 | + 'fields' => $model->fields()->map(function(Field $field) use ($model) { |
|
| 154 | 154 | // TODO refactor so render method of field takes model and managerViewModel as arguments. |
| 155 | 155 | return $field->model($model) |
| 156 | 156 | ->viewData(['managerViewModel' => new managerViewModel($this)]); |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | $model->saveFields($model->fields(), $request->all(), $request->allFiles()); |
| 171 | 171 | |
| 172 | 172 | return redirect()->to($this->route('edit', $model)) |
| 173 | - ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i> "' . $model->adminLabel('title') . '" is aangepast'); |
|
| 173 | + ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i> "'.$model->adminLabel('title').'" is aangepast'); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | public function delete($id, Request $request) |
@@ -180,12 +180,12 @@ discard block |
||
| 180 | 180 | $model = static::managedModelClass()::findOrFail($id); |
| 181 | 181 | |
| 182 | 182 | if ($request->get('deleteconfirmation') !== 'DELETE') { |
| 183 | - return redirect()->back()->with('messages.warning', $model->adminLabel('title') . ' is niet verwijderd.'); |
|
| 183 | + return redirect()->back()->with('messages.warning', $model->adminLabel('title').' is niet verwijderd.'); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | app(DeleteManagedModel::class)->handle($model); |
| 187 | 187 | |
| 188 | 188 | return redirect()->to($this->route('index')) |
| 189 | - ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i> "' . $model->adminLabel('title') . '" is verwijderd.'); |
|
| 189 | + ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i> "'.$model->adminLabel('title').'" is verwijderd.'); |
|
| 190 | 190 | } |
| 191 | 191 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | public function tagged($tags): self |
| 16 | 16 | { |
| 17 | - $tags = (array) $tags; |
|
| 17 | + $tags = (array)$tags; |
|
| 18 | 18 | |
| 19 | 19 | return $this->filter(function($value, $key) use($tags){ |
| 20 | 20 | return count(array_intersect($value, $tags)) > 0; |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | public function notTagged($tags): self |
| 25 | 25 | { |
| 26 | - $tags = (array) $tags; |
|
| 26 | + $tags = (array)$tags; |
|
| 27 | 27 | |
| 28 | 28 | return $this->filter(function($value, $key) use($tags){ |
| 29 | 29 | return count(array_intersect($value, $tags)) === 0; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | public function untagged($tags): self |
| 34 | 34 | { |
| 35 | - $tags = (array) $tags; |
|
| 35 | + $tags = (array)$tags; |
|
| 36 | 36 | |
| 37 | 37 | return $this->filter(function($value, $key) use($tags){ |
| 38 | 38 | return empty($value); |
@@ -29,6 +29,6 @@ |
||
| 29 | 29 | ); |
| 30 | 30 | |
| 31 | 31 | $this->container->make(ModelToManagerMap::class)->map($class::managedModelClass(), $class); |
| 32 | - $this->container->make(RegisteredManagers::class)->tag($class, (array) $tags); |
|
| 32 | + $this->container->make(RegisteredManagers::class)->tag($class, (array)$tags); |
|
| 33 | 33 | } |
| 34 | 34 | } |