@@ -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(); |
@@ -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 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | protected function indexSorting(Builder $builder): Builder |
127 | 127 | { |
128 | - if($this->isManualSortable()) { |
|
128 | + if ($this->isManualSortable()) { |
|
129 | 129 | $builder->sortedManually(); |
130 | 130 | } |
131 | 131 | |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | { |
146 | 146 | $paginator = $builder->paginate($this->pageCount); |
147 | 147 | |
148 | - $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function ($model) { |
|
148 | + $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function($model) { |
|
149 | 149 | return (new static($this->registration))->manage($model); |
150 | 150 | }); |
151 | 151 | |
152 | - foreach(request()->query() as $key => $value) { |
|
153 | - if($key == 'page') continue; |
|
152 | + foreach (request()->query() as $key => $value) { |
|
153 | + if ($key == 'page') continue; |
|
154 | 154 | $paginator->appends($key, $value); |
155 | 155 | } |
156 | 156 | |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | { |
275 | 275 | $fields = $this->fieldsWithAssistantFields(); |
276 | 276 | |
277 | - if($this->isManualSortable() && !$fields->offsetExists('order')) { |
|
277 | + if ($this->isManualSortable() && !$fields->offsetExists('order')) { |
|
278 | 278 | $fields = $fields->add(NumberField::make('order')); |
279 | 279 | } |
280 | 280 | |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | |
284 | 284 | public function editFields(): Fields |
285 | 285 | { |
286 | - return $this->fieldsWithAssistantFields()->map(function (Field $field) { |
|
286 | + return $this->fieldsWithAssistantFields()->map(function(Field $field) { |
|
287 | 287 | return $field->model($this->model); |
288 | 288 | }); |
289 | 289 | } |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | static::$bootedTraitMethods[$baseMethod] = []; |
377 | 377 | |
378 | 378 | foreach (class_uses_recursive($class) as $trait) { |
379 | - $method = class_basename($trait) . ucfirst($baseMethod); |
|
379 | + $method = class_basename($trait).ucfirst($baseMethod); |
|
380 | 380 | |
381 | 381 | if (method_exists($class, $method) && !in_array($method, static::$bootedTraitMethods[$baseMethod])) { |
382 | 382 | static::$bootedTraitMethods[$baseMethod][] = lcfirst($method); |
@@ -150,7 +150,9 @@ |
||
150 | 150 | }); |
151 | 151 | |
152 | 152 | foreach(request()->query() as $key => $value) { |
153 | - if($key == 'page') continue; |
|
153 | + if($key == 'page') { |
|
154 | + continue; |
|
155 | + } |
|
154 | 156 | $paginator->appends($key, $value); |
155 | 157 | } |
156 | 158 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | { |
24 | 24 | return (new static(new FieldType(FieldType::FILE), $key)) |
25 | 25 | ->locales([config('app.fallback_locale', 'nl')]) |
26 | - ->valueResolver(function ($model = null, $locale = null, FileField $field) { |
|
26 | + ->valueResolver(function($model = null, $locale = null, FileField $field) { |
|
27 | 27 | return $field->getMedia($model, $locale); |
28 | 28 | }); |
29 | 29 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $files = []; |
38 | 38 | $locale = $locale ?? app()->getLocale(); |
39 | 39 | |
40 | - $assets = $model->assetRelation->where('pivot.type', $this->getKey())->filter(function ($asset) use ($locale) { |
|
40 | + $assets = $model->assetRelation->where('pivot.type', $this->getKey())->filter(function($asset) use ($locale) { |
|
41 | 41 | return $asset->pivot->locale == $locale; |
42 | 42 | })->sortBy('pivot.order'); |
43 | 43 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $thumbUrl = $asset->url('thumb'); |
48 | 48 | |
49 | 49 | // If the conversions haven't run yet, we'll use the original image until they are uploaded |
50 | - if(!file_exists(public_path($thumbUrl))) { |
|
50 | + if (!file_exists(public_path($thumbUrl))) { |
|
51 | 51 | $thumbUrl = $asset->url(); |
52 | 52 | } |
53 | 53 |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $this->pageBuilderField(), |
85 | 85 | InputField::make('title')->translatable($this->model->availableLocales()) |
86 | 86 | ->validation('required-fallback-locale|max:200', [], [ |
87 | - 'trans.' . config('app.fallback_locale', 'nl') . '.title' => 'title', |
|
87 | + 'trans.'.config('app.fallback_locale', 'nl').'.title' => 'title', |
|
88 | 88 | ]) |
89 | 89 | ->label('Intern label') |
90 | 90 | ->description('Dit is de benaming die zal worden getoond in de admin selectie velden.') |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | $this->model->morph_key = $this->model->morphKey(); |
154 | 154 | } |
155 | 155 | |
156 | - if($this->isManualSortable() && !$request->has('order')) { |
|
157 | - $this->model->order = $this->modelInstance()::orderBy('order', 'desc')->first()->order + 1; |
|
156 | + if ($this->isManualSortable() && !$request->has('order')) { |
|
157 | + $this->model->order = $this->modelInstance()::orderBy('order', 'desc')->first()->order+1; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | parent::saveFields($request, $this->createFields()->merge($this->fieldsWithAssistantFields()->keyed('url-slugs'))); |
@@ -203,12 +203,12 @@ discard block |
||
203 | 203 | if (!isset($urls[$locale]) && isset($translation['title'])) { |
204 | 204 | $append = ''; $i = 1; |
205 | 205 | |
206 | - do{ |
|
207 | - $urls[$locale] = Str::slug($translation['title']) . $append; |
|
206 | + do { |
|
207 | + $urls[$locale] = Str::slug($translation['title']).$append; |
|
208 | 208 | $append = "$i"; |
209 | 209 | $i++; |
210 | 210 | } |
211 | - while(!$urlValidator->passes(null, [$locale => $urls[$locale]])); |
|
211 | + while (!$urlValidator->passes(null, [$locale => $urls[$locale]])); |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | if (is_array_empty($translation)) { |
224 | 224 | |
225 | 225 | // Nullify all values |
226 | - $trans[$locale] = array_map(function ($value) { |
|
226 | + $trans[$locale] = array_map(function($value) { |
|
227 | 227 | return null; |
228 | 228 | }, $translation); |
229 | 229 | continue; |
@@ -21,7 +21,7 @@ |
||
21 | 21 | file_put_contents($filepath, $xmlString); |
22 | 22 | |
23 | 23 | // If this is the default locale, we'll create a default sitemap.xml as well |
24 | - if($locale == config('app.fallback_locale')) { |
|
24 | + if ($locale == config('app.fallback_locale')) { |
|
25 | 25 | file_put_contents(public_path('sitemap.xml'), $xmlString); |
26 | 26 | } |
27 | 27 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | { |
14 | 14 | public function handle(HasAsset $model, MediaField $field, array $requestValues, Request $request): void |
15 | 15 | { |
16 | - if($field->getStorageDisk()) { |
|
16 | + if ($field->getStorageDisk()) { |
|
17 | 17 | $this->setDisk($field->getStorageDisk()); |
18 | 18 | } |
19 | 19 |
@@ -14,11 +14,11 @@ |
||
14 | 14 | { |
15 | 15 | public function handle(HasAsset $model, MediaField $field, Request $request): void |
16 | 16 | { |
17 | - if($field->getStorageDisk()) { |
|
17 | + if ($field->getStorageDisk()) { |
|
18 | 18 | $this->setDisk($field->getStorageDisk()); |
19 | 19 | } |
20 | 20 | |
21 | - foreach ([$request->file('files.' . $field->getName(), []), $request->input('files.' . $field->getName(), [])] as $requestPayload) { |
|
21 | + foreach ([$request->file('files.'.$field->getName(), []), $request->input('files.'.$field->getName(), [])] as $requestPayload) { |
|
22 | 22 | foreach ($requestPayload as $locale => $values) { |
23 | 23 | $this->handlePayload($model, $field, $locale, $values); |
24 | 24 | } |