@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $this->pageBuilderField(), |
| 84 | 84 | InputField::make('title')->translatable($this->model->availableLocales()) |
| 85 | 85 | ->validation('required-fallback-locale|max:200', [], [ |
| 86 | - 'trans.' . config('app.fallback_locale', 'nl') . '.title' => 'title', |
|
| 86 | + 'trans.'.config('app.fallback_locale', 'nl').'.title' => 'title', |
|
| 87 | 87 | ]) |
| 88 | 88 | ->label('Intern label') |
| 89 | 89 | ->description('Dit is de benaming die zal worden getoond in de admin selectie velden.') |
@@ -152,8 +152,8 @@ discard block |
||
| 152 | 152 | $this->model->morph_key = $this->model->morphKey(); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - if($this->isManualSortable() && !$request->has('order')) { |
|
| 156 | - $this->model->order = $this->modelInstance()::orderBy('order', 'desc')->first()->order + 1; |
|
| 155 | + if ($this->isManualSortable() && !$request->has('order')) { |
|
| 156 | + $this->model->order = $this->modelInstance()::orderBy('order', 'desc')->first()->order+1; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | parent::saveFields($request, $this->createFields()->merge($this->fieldsWithAssistantFields()->keyed('url-slugs'))); |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | if (is_array_empty($translation)) { |
| 213 | 213 | |
| 214 | 214 | // Nullify all values |
| 215 | - $trans[$locale] = array_map(function ($value) { |
|
| 215 | + $trans[$locale] = array_map(function($value) { |
|
| 216 | 216 | return null; |
| 217 | 217 | }, $translation); |
| 218 | 218 | continue; |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | $params = []; |
| 23 | 23 | |
| 24 | 24 | foreach ($indices as $index => $modelId) { |
| 25 | - $id = (int) $modelId; |
|
| 25 | + $id = (int)$modelId; |
|
| 26 | 26 | $cases[] = "WHEN {$id} then ?"; |
| 27 | 27 | $params[] = $index; |
| 28 | 28 | $ids[] = $id; |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | public function saveCreateFields(Request $request): void |
| 80 | 80 | { |
| 81 | - if($this->isManualSortable() && !$request->has('order')) { |
|
| 82 | - $this->model->order = $this->modelInstance()::orderBy('order', 'desc')->first()->order + 1; |
|
| 81 | + if ($this->isManualSortable() && !$request->has('order')) { |
|
| 82 | + $this->model->order = $this->modelInstance()::orderBy('order', 'desc')->first()->order+1; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $this->saveFields($request, $this->createFields()); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | return $this->indexPagination($builder); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - return $builder->get()->map(function ($model) { |
|
| 109 | + return $builder->get()->map(function($model) { |
|
| 110 | 110 | return (new static($this->registration))->manage($model); |
| 111 | 111 | }); |
| 112 | 112 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | protected function indexSorting(Builder $builder): Builder |
| 120 | 120 | { |
| 121 | - if($this->isManualSortable()) { |
|
| 121 | + if ($this->isManualSortable()) { |
|
| 122 | 122 | $builder->sortedManually(); |
| 123 | 123 | } |
| 124 | 124 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | { |
| 139 | 139 | $paginator = $builder->paginate($this->pageCount); |
| 140 | 140 | |
| 141 | - $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function ($model) { |
|
| 141 | + $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function($model) { |
|
| 142 | 142 | return (new static($this->registration))->manage($model); |
| 143 | 143 | }); |
| 144 | 144 | |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | { |
| 262 | 262 | $fields = $this->fieldsWithAssistantFields(); |
| 263 | 263 | |
| 264 | - if($this->isManualSortable() && !$fields->offsetExists('order')) { |
|
| 264 | + if ($this->isManualSortable() && !$fields->offsetExists('order')) { |
|
| 265 | 265 | $fields = $fields->add(NumberField::make('order')); |
| 266 | 266 | } |
| 267 | 267 | |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | public function editFields(): Fields |
| 272 | 272 | { |
| 273 | - return $this->fieldsWithAssistantFields()->map(function (Field $field) { |
|
| 273 | + return $this->fieldsWithAssistantFields()->map(function(Field $field) { |
|
| 274 | 274 | return $field->model($this->model); |
| 275 | 275 | }); |
| 276 | 276 | } |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | static::$bootedTraitMethods[$baseMethod] = []; |
| 364 | 364 | |
| 365 | 365 | foreach (class_uses_recursive($class) as $trait) { |
| 366 | - $method = class_basename($trait) . ucfirst($baseMethod); |
|
| 366 | + $method = class_basename($trait).ucfirst($baseMethod); |
|
| 367 | 367 | |
| 368 | 368 | if (method_exists($class, $method) && !in_array($method, static::$bootedTraitMethods[$baseMethod])) { |
| 369 | 369 | static::$bootedTraitMethods[$baseMethod][] = lcfirst($method); |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | app($notifier)->onFailure($checkInstance); |
| 34 | 34 | } |
| 35 | 35 | break; |
| 36 | - } else { |
|
| 36 | + }else { |
|
| 37 | 37 | foreach ($notifiers as $notifier) { |
| 38 | 38 | app($notifier)->onSuccess($checkInstance); |
| 39 | 39 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $this->removeModules($referred_instances); |
| 55 | 55 | |
| 56 | 56 | foreach ($referred_instances as $i => $instance) { |
| 57 | - if(!$relation = Relation::find($this->model->getMorphClass(), $this->model->id, $instance->getMorphClass(), $instance->id)) { |
|
| 57 | + if (!$relation = Relation::find($this->model->getMorphClass(), $this->model->id, $instance->getMorphClass(), $instance->id)) { |
|
| 58 | 58 | $this->model->adoptChild($instance, ['sort' => $i]); |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -64,16 +64,16 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | public function updateSets() |
| 66 | 66 | { |
| 67 | - $stored_set_refs = collect($this->set_refs)->reject(function($ref){ |
|
| 67 | + $stored_set_refs = collect($this->set_refs)->reject(function($ref) { |
|
| 68 | 68 | return !$ref; |
| 69 | - })->map(function($flat_set_ref){ |
|
| 69 | + })->map(function($flat_set_ref) { |
|
| 70 | 70 | return $this->findOrCreateStoredSetReference($flat_set_ref); |
| 71 | 71 | }); |
| 72 | 72 | |
| 73 | 73 | $this->removeSets($stored_set_refs); |
| 74 | 74 | |
| 75 | 75 | foreach ($stored_set_refs as $i => $stored_set_ref) { |
| 76 | - if(!$relation = Relation::find($this->model->getMorphClass(), $this->model->id, $stored_set_ref->getMorphClass(), $stored_set_ref->id)) { |
|
| 76 | + if (!$relation = Relation::find($this->model->getMorphClass(), $this->model->id, $stored_set_ref->getMorphClass(), $stored_set_ref->id)) { |
|
| 77 | 77 | $this->model->adoptChild($stored_set_ref, ['sort' => $i]); |
| 78 | 78 | } |
| 79 | 79 | } |
@@ -87,14 +87,14 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | private function removeModules(Collection $referred_instances): void |
| 89 | 89 | { |
| 90 | - $this->model->children()->filter(function ($instance) { |
|
| 90 | + $this->model->children()->filter(function($instance) { |
|
| 91 | 91 | return (!$instance instanceof StoredSetReference && !$instance instanceof TextModule && !$instance instanceof PagetitleModule); |
| 92 | - })->reject(function ($instance) use ($referred_instances) { |
|
| 92 | + })->reject(function($instance) use ($referred_instances) { |
|
| 93 | 93 | // If this model still exists in the update request, we'll reject it from the removed list. |
| 94 | - return $referred_instances->filter(function ($referred_instance) use ($instance) { |
|
| 94 | + return $referred_instances->filter(function($referred_instance) use ($instance) { |
|
| 95 | 95 | return (get_class($referred_instance) == get_class($instance) && $referred_instance->id == $instance->id); |
| 96 | 96 | })->isNotEmpty(); |
| 97 | - })->each(function ($instance) { |
|
| 97 | + })->each(function($instance) { |
|
| 98 | 98 | $this->model->rejectChild($instance); |
| 99 | 99 | }); |
| 100 | 100 | } |
@@ -105,14 +105,14 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | private function removeSets(Collection $referred_instances): void |
| 107 | 107 | { |
| 108 | - $this->model->children()->filter(function ($instance) { |
|
| 108 | + $this->model->children()->filter(function($instance) { |
|
| 109 | 109 | return ($instance instanceof StoredSetReference); |
| 110 | - })->reject(function ($instance) use ($referred_instances) { |
|
| 110 | + })->reject(function($instance) use ($referred_instances) { |
|
| 111 | 111 | // If this model still exists in the update request, we'll reject it from the removed list. |
| 112 | - return $referred_instances->filter(function ($referred_instance) use ($instance) { |
|
| 112 | + return $referred_instances->filter(function($referred_instance) use ($instance) { |
|
| 113 | 113 | return (get_class($referred_instance) == get_class($instance) && $referred_instance->id == $instance->id); |
| 114 | 114 | })->isNotEmpty(); |
| 115 | - })->each(function ($instance) { |
|
| 115 | + })->each(function($instance) { |
|
| 116 | 116 | $this->model->rejectChild($instance); |
| 117 | 117 | }); |
| 118 | 118 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | continue; |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - $child = $children->first(function ($c) use ($reference) { |
|
| 232 | + $child = $children->first(function($c) use ($reference) { |
|
| 233 | 233 | return $c->flatReference()->get() == $reference; |
| 234 | 234 | }); |
| 235 | 235 | |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | private function stripTagsBlacklist($value, $blacklist = []) |
| 281 | 281 | { |
| 282 | 282 | foreach ($blacklist as $tag) { |
| 283 | - $value = preg_replace('/<\/?' . $tag . '(.|\s)*?>/', '', $value); |
|
| 283 | + $value = preg_replace('/<\/?'.$tag.'(.|\s)*?>/', '', $value); |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | return $value; |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | public static function find(string $parent_type, $parent_id, string $child_type, $child_id): ?Relation |
| 22 | 22 | { |
| 23 | 23 | return static::query() |
| 24 | - ->where('parent_type', $parent_type ) |
|
| 25 | - ->where('parent_id', $parent_id ) |
|
| 26 | - ->where('child_type', $child_type ) |
|
| 27 | - ->where('child_id', $child_id ) |
|
| 24 | + ->where('parent_type', $parent_type) |
|
| 25 | + ->where('parent_id', $parent_id) |
|
| 26 | + ->where('child_type', $child_type) |
|
| 27 | + ->where('child_id', $child_id) |
|
| 28 | 28 | ->first(); |
| 29 | 29 | } |
| 30 | 30 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | ->orderBy('sort', 'ASC') |
| 76 | 76 | ->get(); |
| 77 | 77 | |
| 78 | - return $relations->map(function (Relation $relation) { |
|
| 78 | + return $relations->map(function(Relation $relation) { |
|
| 79 | 79 | $parent = $relation->parent; |
| 80 | 80 | $parent->relation = $relation; |
| 81 | 81 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | ->orderBy('sort', 'ASC') |
| 92 | 92 | ->get(); |
| 93 | 93 | |
| 94 | - return $relations->map(function (Relation $relation) use ($parent_type, $parent_id) { |
|
| 94 | + return $relations->map(function(Relation $relation) use ($parent_type, $parent_id) { |
|
| 95 | 95 | |
| 96 | 96 | // It could be that the child itself is archived, soft-deleted or removed. If this is the case, we will ignore it and move on. |
| 97 | 97 | if (!$child = $relation->child) { |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | }) |
| 105 | 105 | |
| 106 | 106 | // In case of soft-deleted entries, this will be null and should be ignored. We make sure that keys are reset in case of removed child |
| 107 | - ->reject(function ($child) { |
|
| 107 | + ->reject(function($child) { |
|
| 108 | 108 | return is_null($child); |
| 109 | 109 | }) |
| 110 | 110 | ->values(); |
@@ -121,10 +121,10 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | public static function deleteRelationsOf($type, $id) |
| 123 | 123 | { |
| 124 | - $relations = static::where(function ($query) use ($type, $id) { |
|
| 124 | + $relations = static::where(function($query) use ($type, $id) { |
|
| 125 | 125 | return $query->where('parent_type', $type) |
| 126 | 126 | ->where('parent_id', $id); |
| 127 | - })->orWhere(function ($query) use ($type, $id) { |
|
| 127 | + })->orWhere(function($query) use ($type, $id) { |
|
| 128 | 128 | return $query->where('child_type', $type) |
| 129 | 129 | ->where('child_id', $id); |
| 130 | 130 | })->get(); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | public static function deleteAllChildRelationsOf($type, $id) |
| 138 | 138 | { |
| 139 | - $relations = static::where(function ($query) use ($type, $id) { |
|
| 139 | + $relations = static::where(function($query) use ($type, $id) { |
|
| 140 | 140 | return $query->where('parent_type', $type) |
| 141 | 141 | ->where('parent_id', $id); |
| 142 | 142 | })->get(); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | public static function deleteAllParentRelationsOf($type, $id) |
| 150 | 150 | { |
| 151 | - $relations = static::where(function ($query) use ($type, $id) { |
|
| 151 | + $relations = static::where(function($query) use ($type, $id) { |
|
| 152 | 152 | return $query->where('child_type', $type) |
| 153 | 153 | ->where('child_id', $id); |
| 154 | 154 | })->get(); |