@@ -21,7 +21,7 @@ discard block  | 
                                                    ||
| 21 | 21 | |
| 22 | 22 | // Mark the slug as deleted to avoid any conflict with newly created modules with the same slug.  | 
                                                        
| 23 | 23 | $module->update([  | 
                                                        
| 24 | - 'slug' => $module->slug . $this->appendDeleteMarker(),  | 
                                                        |
| 24 | + 'slug' => $module->slug.$this->appendDeleteMarker(),  | 
                                                        |
| 25 | 25 | ]);  | 
                                                        
| 26 | 26 | |
| 27 | 27 | $module->delete();  | 
                                                        
@@ -35,6 +35,6 @@ discard block  | 
                                                    ||
| 35 | 35 | |
| 36 | 36 | private function appendDeleteMarker(): string  | 
                                                        
| 37 | 37 |      { | 
                                                        
| 38 | - return '_DELETED_' . time();  | 
                                                        |
| 38 | + return '_DELETED_'.time();  | 
                                                        |
| 39 | 39 | }  | 
                                                        
| 40 | 40 | }  | 
                                                        
@@ -112,7 +112,7 @@ discard block  | 
                                                    ||
| 112 | 112 |          if (is_string($file) && isset(json_decode($file)->output)) { | 
                                                        
| 113 | 113 | $image_name = json_decode($file)->output->name;  | 
                                                        
| 114 | 114 | $asset = app(AddAsset::class)->add($model, json_decode($file)->output->image, $type, $locale, $this->sluggifyFilename($image_name));  | 
                                                        
| 115 | -        } else { | 
                                                        |
| 115 | +        }else { | 
                                                        |
| 116 | 116 |              if ($file instanceof UploadedFile) { | 
                                                        
| 117 | 117 | $image_name = $file->getClientOriginalName();  | 
                                                        
| 118 | 118 | |
@@ -123,7 +123,7 @@ discard block  | 
                                                    ||
| 123 | 123 |                  if (false !== ($key = array_search($image_name, $files_order))) { | 
                                                        
| 124 | 124 | $files_order[$key] = (string)$asset->id;  | 
                                                        
| 125 | 125 | }  | 
                                                        
| 126 | -            } else { | 
                                                        |
| 126 | +            }else { | 
                                                        |
| 127 | 127 | $file = Asset::find($file);  | 
                                                        
| 128 | 128 |                  if ($file) { | 
                                                        
| 129 | 129 |                      if ($model->assetRelation()->where('asset_pivots.type', $type)->where('asset_pivots.locale', $locale)->get()->contains($file)) { | 
                                                        
@@ -142,9 +142,9 @@ discard block  | 
                                                    ||
| 142 | 142 | */  | 
                                                        
| 143 | 143 | private function sluggifyFilename($filename): string  | 
                                                        
| 144 | 144 |      { | 
                                                        
| 145 | - $extension = substr($filename, strrpos($filename, '.') + 1);  | 
                                                        |
| 145 | + $extension = substr($filename, strrpos($filename, '.')+1);  | 
                                                        |
| 146 | 146 | $filename = substr($filename, 0, strrpos($filename, '.'));  | 
                                                        
| 147 | - $filename = Str::slug($filename) . '.' . $extension;  | 
                                                        |
| 147 | + $filename = Str::slug($filename).'.'.$extension;  | 
                                                        |
| 148 | 148 | |
| 149 | 149 | return $filename;  | 
                                                        
| 150 | 150 | }  | 
                                                        
@@ -160,9 +160,9 @@ discard block  | 
                                                    ||
| 160 | 160 |                  if ($file instanceof UploadedFile && !$file->isValid()) { | 
                                                        
| 161 | 161 |                      if ($file->getError() == UPLOAD_ERR_INI_SIZE) { | 
                                                        
| 162 | 162 | throw new FileTooBigException(  | 
                                                        
| 163 | - 'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. ' .  | 
                                                        |
| 164 | -                            'upload_max_filesize: ' . (int)ini_get('upload_max_filesize') . 'MB, ' . | 
                                                        |
| 165 | -                            'post_max_size: ' . (int)(ini_get('post_max_size')) . 'MB' | 
                                                        |
| 163 | + 'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. '.  | 
                                                        |
| 164 | +                            'upload_max_filesize: '.(int)ini_get('upload_max_filesize').'MB, '. | 
                                                        |
| 165 | +                            'post_max_size: '.(int)(ini_get('post_max_size')).'MB' | 
                                                        |
| 166 | 166 | );  | 
                                                        
| 167 | 167 | }  | 
                                                        
| 168 | 168 | }  | 
                                                        
@@ -177,7 +177,7 @@ discard block  | 
                                                    ||
| 177 | 177 |              foreach ($files as $locale => $_files) { | 
                                                        
| 178 | 178 |                  foreach ($_files as $action => $file) { | 
                                                        
| 179 | 179 |                      if (!in_array($action, $actions)) { | 
                                                        
| 180 | -                        throw new \InvalidArgumentException('A valid files entry should have a key of either [' . implode(',', $actions) . ']. Instead ' . $action . ' is given.'); | 
                                                        |
| 180 | +                        throw new \InvalidArgumentException('A valid files entry should have a key of either ['.implode(',', $actions).']. Instead '.$action.' is given.'); | 
                                                        |
| 181 | 181 | }  | 
                                                        
| 182 | 182 | }  | 
                                                        
| 183 | 183 | }  | 
                                                        
@@ -140,10 +140,10 @@ discard block  | 
                                                    ||
| 140 | 140 | return $filename;  | 
                                                        
| 141 | 141 | }  | 
                                                        
| 142 | 142 | |
| 143 | - $extension = substr($filename, strrpos($filename, '.') + 1);  | 
                                                        |
| 143 | + $extension = substr($filename, strrpos($filename, '.')+1);  | 
                                                        |
| 144 | 144 | $filename = substr($filename, 0, strrpos($filename, '.'));  | 
                                                        
| 145 | 145 | |
| 146 | - return Str::slug($filename) . '.' . $extension;  | 
                                                        |
| 146 | + return Str::slug($filename).'.'.$extension;  | 
                                                        |
| 147 | 147 | }  | 
                                                        
| 148 | 148 | |
| 149 | 149 | protected function sort(HasAsset $model, MediaField $field, array $input)  | 
                                                        
@@ -169,8 +169,8 @@ discard block  | 
                                                    ||
| 169 | 169 | $values = isset($fileIdInput[$key])  | 
                                                        
| 170 | 170 | ? $fileIdInput[$key]  | 
                                                        
| 171 | 171 | : (  | 
                                                        
| 172 | - isset($fileIdInput['files-' . $key])  | 
                                                        |
| 173 | - ? $fileIdInput['files-' . $key]  | 
                                                        |
| 172 | + isset($fileIdInput['files-'.$key])  | 
                                                        |
| 173 | + ? $fileIdInput['files-'.$key]  | 
                                                        |
| 174 | 174 | : ''  | 
                                                        
| 175 | 175 | );  | 
                                                        
| 176 | 176 | |
@@ -14,7 +14,7 @@  | 
                                                    ||
| 14 | 14 |  { | 
                                                        
| 15 | 15 | public function handle(HasAsset $model, MediaField $field, array $input, array $files): void  | 
                                                        
| 16 | 16 |      { | 
                                                        
| 17 | -        foreach ([data_get($files, 'files.' . $field->getName(), []), data_get($input, 'files.' . $field->getName(), [])] as $requestPayload) { | 
                                                        |
| 17 | +        foreach ([data_get($files, 'files.'.$field->getName(), []), data_get($input, 'files.'.$field->getName(), [])] as $requestPayload) { | 
                                                        |
| 18 | 18 |              foreach ($requestPayload as $locale => $values) { | 
                                                        
| 19 | 19 | $this->handlePayload($model, $field, $locale, $values);  | 
                                                        
| 20 | 20 | }  | 
                                                        
@@ -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;  | 
                                                        
@@ -43,16 +43,16 @@  | 
                                                    ||
| 43 | 43 | $filename = $filePayload['filename'];  | 
                                                        
| 44 | 44 | |
| 45 | 45 |              if (!$asset = AssetUploader::uploadFromBase64($base64EncodedFile, $filename)) { | 
                                                        
| 46 | - $responseContent['file-' . rand(1 - 999)] = [  | 
                                                        |
| 46 | + $responseContent['file-'.rand(1-999)] = [  | 
                                                        |
| 47 | 47 | 'error' => true,  | 
                                                        
| 48 | - 'messages' => 'Afbeelding [' . $filename . '] kan niet worden opgeladen.',  | 
                                                        |
| 48 | + 'messages' => 'Afbeelding ['.$filename.'] kan niet worden opgeladen.',  | 
                                                        |
| 49 | 49 | ];  | 
                                                        
| 50 | 50 | continue;  | 
                                                        
| 51 | 51 | }  | 
                                                        
| 52 | 52 | |
| 53 | 53 |              app(AddAsset::class)->add($model, $asset, MediaType::CONTENT, $request->input('locale', app()->getLocale())); | 
                                                        
| 54 | 54 | |
| 55 | - $responseContent['file-' . $asset->id] = [  | 
                                                        |
| 55 | + $responseContent['file-'.$asset->id] = [  | 
                                                        |
| 56 | 56 | 'url' => $asset->url(),  | 
                                                        
| 57 | 57 | 'id' => $asset->id,  | 
                                                        
| 58 | 58 | ];  | 
                                                        
@@ -9,7 +9,7 @@ discard block  | 
                                                    ||
| 9 | 9 |  { | 
                                                        
| 10 | 10 | public function canPreviewAssistant(string $action, $model = null): bool  | 
                                                        
| 11 | 11 |      { | 
                                                        
| 12 | - if($action !== 'preview' || !$model) return false;  | 
                                                        |
| 12 | + if ($action !== 'preview' || !$model) return false;  | 
                                                        |
| 13 | 13 | |
| 14 | 14 | return $model instanceof ProvidesUrl;  | 
                                                        
| 15 | 15 | }  | 
                                                        
@@ -27,7 +27,7 @@ discard block  | 
                                                    ||
| 27 | 27 | */  | 
                                                        
| 28 | 28 | public function routePreviewAssistant(string $action, $model = null, ...$parameters): ?string  | 
                                                        
| 29 | 29 |      { | 
                                                        
| 30 | - if(!$this->canPreviewAssistant($action, $model)) return null;  | 
                                                        |
| 30 | + if (!$this->canPreviewAssistant($action, $model)) return null;  | 
                                                        |
| 31 | 31 | |
| 32 | 32 | return $model->url();  | 
                                                        
| 33 | 33 | }  | 
                                                        
@@ -9,7 +9,9 @@ discard block  | 
                                                    ||
| 9 | 9 |  { | 
                                                        
| 10 | 10 | public function canPreviewAssistant(string $action, $model = null): bool  | 
                                                        
| 11 | 11 |      { | 
                                                        
| 12 | - if($action !== 'preview' || !$model) return false;  | 
                                                        |
| 12 | +        if($action !== 'preview' || !$model) { | 
                                                        |
| 13 | + return false;  | 
                                                        |
| 14 | + }  | 
                                                        |
| 13 | 15 | |
| 14 | 16 | return $model instanceof ProvidesUrl;  | 
                                                        
| 15 | 17 | }  | 
                                                        
@@ -27,7 +29,9 @@ discard block  | 
                                                    ||
| 27 | 29 | */  | 
                                                        
| 28 | 30 | public function routePreviewAssistant(string $action, $model = null, ...$parameters): ?string  | 
                                                        
| 29 | 31 |      { | 
                                                        
| 30 | - if(!$this->canPreviewAssistant($action, $model)) return null;  | 
                                                        |
| 32 | +        if(!$this->canPreviewAssistant($action, $model)) { | 
                                                        |
| 33 | + return null;  | 
                                                        |
| 34 | + }  | 
                                                        |
| 31 | 35 | |
| 32 | 36 | return $model->url();  | 
                                                        
| 33 | 37 | }  | 
                                                        
@@ -27,12 +27,12 @@ discard block  | 
                                                    ||
| 27 | 27 | */  | 
                                                        
| 28 | 28 | public function saveFields(Fields $fields, array $input, array $files): void  | 
                                                        
| 29 | 29 |      { | 
                                                        
| 30 | -        foreach($fields as $field){ | 
                                                        |
| 31 | -            if($this->detectCustomSaveMethod($field)) { | 
                                                        |
| 30 | +        foreach ($fields as $field) { | 
                                                        |
| 31 | +            if ($this->detectCustomSaveMethod($field)) { | 
                                                        |
| 32 | 32 | continue;  | 
                                                        
| 33 | 33 | }  | 
                                                        
| 34 | 34 | |
| 35 | - if(!$field->isLocalized())  | 
                                                        |
| 35 | + if (!$field->isLocalized())  | 
                                                        |
| 36 | 36 |              { | 
                                                        
| 37 | 37 | // Set standard non-localized attribute on the model  | 
                                                        
| 38 | 38 | ($customSetMethod = $this->detectCustomSetMethod($field))  | 
                                                        
@@ -45,11 +45,11 @@ discard block  | 
                                                    ||
| 45 | 45 | // Dynamic localized values or standard translated  | 
                                                        
| 46 | 46 | // For standard translations we set value with the colon notation, e.g. title:en  | 
                                                        
| 47 | 47 |              $this->foreachTranslationEntry(data_get($input, 'trans', []), function($locale, $key, $value) use($field){ | 
                                                        
| 48 | - if($key !== $field->getColumn()) return;  | 
                                                        |
| 48 | + if ($key !== $field->getColumn()) return;  | 
                                                        |
| 49 | 49 | |
| 50 | -                if($this->isFieldForDynamicValue($field)) { | 
                                                        |
| 50 | +                if ($this->isFieldForDynamicValue($field)) { | 
                                                        |
| 51 | 51 | $this->setDynamic($key, $value, $locale);  | 
                                                        
| 52 | -                } else { | 
                                                        |
| 52 | +                }else { | 
                                                        |
| 53 | 53 |                      $this->{$field->getColumn().':'.$locale} = $value; | 
                                                        
| 54 | 54 | }  | 
                                                        
| 55 | 55 | });  | 
                                                        
@@ -58,8 +58,8 @@ discard block  | 
                                                    ||
| 58 | 58 | $this->save();  | 
                                                        
| 59 | 59 | |
| 60 | 60 | // Custom save methods  | 
                                                        
| 61 | -        foreach($fields as $field){ | 
                                                        |
| 62 | -            if($customSaveMethod = $this->detectCustomSaveMethod($field)) { | 
                                                        |
| 61 | +        foreach ($fields as $field) { | 
                                                        |
| 62 | +            if ($customSaveMethod = $this->detectCustomSaveMethod($field)) { | 
                                                        |
| 63 | 63 | $this->$customSaveMethod($field, $input, $files);  | 
                                                        
| 64 | 64 | }  | 
                                                        
| 65 | 65 | }  | 
                                                        
@@ -72,8 +72,8 @@ discard block  | 
                                                    ||
| 72 | 72 | |
| 73 | 73 | private function detectCustomSaveMethod(Field $field): ?string  | 
                                                        
| 74 | 74 |      { | 
                                                        
| 75 | - $saveMethodByKey = 'save' . ucfirst(Str::camel($field->getKey())) . 'Field';  | 
                                                        |
| 76 | - $saveMethodByType = 'save' . ucfirst(Str::camel($field->getType()->get())) . 'Fields';  | 
                                                        |
| 75 | + $saveMethodByKey = 'save'.ucfirst(Str::camel($field->getKey())).'Field';  | 
                                                        |
| 76 | + $saveMethodByType = 'save'.ucfirst(Str::camel($field->getType()->get())).'Fields';  | 
                                                        |
| 77 | 77 | |
| 78 | 78 |          foreach ([$saveMethodByKey, $saveMethodByType] as $saveMethod) { | 
                                                        
| 79 | 79 |              if (method_exists($this, $saveMethod)) { | 
                                                        
@@ -86,7 +86,7 @@ discard block  | 
                                                    ||
| 86 | 86 | |
| 87 | 87 | private function detectCustomSetMethod(Field $field): ?string  | 
                                                        
| 88 | 88 |      { | 
                                                        
| 89 | - $methodName = 'set' . ucfirst(Str::camel($field->getKey())) . 'Field';  | 
                                                        |
| 89 | + $methodName = 'set'.ucfirst(Str::camel($field->getKey())).'Field';  | 
                                                        |
| 90 | 90 | |
| 91 | 91 | return (method_exists($this, $methodName)) ? $methodName : null;  | 
                                                        
| 92 | 92 | }  | 
                                                        
@@ -108,13 +108,13 @@ discard block  | 
                                                    ||
| 108 | 108 | |
| 109 | 109 | private function saveImageFields(ImageField $field, array $input)  | 
                                                        
| 110 | 110 |      { | 
                                                        
| 111 | - app(ImageFieldHandler::class)->handle($this, $field, data_get($input, 'images.' . $field->getName(), []), $input);  | 
                                                        |
| 111 | + app(ImageFieldHandler::class)->handle($this, $field, data_get($input, 'images.'.$field->getName(), []), $input);  | 
                                                        |
| 112 | 112 | }  | 
                                                        
| 113 | 113 | |
| 114 | 114 | private function foreachTranslationEntry(array $translations, \Closure $callback)  | 
                                                        
| 115 | 115 |      { | 
                                                        
| 116 | -        foreach($translations as $locale => $trans){ | 
                                                        |
| 117 | -            foreach($trans as $key => $value){ | 
                                                        |
| 116 | +        foreach ($translations as $locale => $trans) { | 
                                                        |
| 117 | +            foreach ($trans as $key => $value) { | 
                                                        |
| 118 | 118 | call_user_func($callback, $locale, $key, $value);  | 
                                                        
| 119 | 119 | }  | 
                                                        
| 120 | 120 | }  | 
                                                        
@@ -45,7 +45,9 @@  | 
                                                    ||
| 45 | 45 | // Dynamic localized values or standard translated  | 
                                                        
| 46 | 46 | // For standard translations we set value with the colon notation, e.g. title:en  | 
                                                        
| 47 | 47 |              $this->foreachTranslationEntry(data_get($input, 'trans', []), function($locale, $key, $value) use($field){ | 
                                                        
| 48 | - if($key !== $field->getColumn()) return;  | 
                                                        |
| 48 | +                if($key !== $field->getColumn()) { | 
                                                        |
| 49 | + return;  | 
                                                        |
| 50 | + }  | 
                                                        |
| 49 | 51 | |
| 50 | 52 |                  if($this->isFieldForDynamicValue($field)) { | 
                                                        
| 51 | 53 | $this->setDynamic($key, $value, $locale);  | 
                                                        
@@ -98,7 +98,7 @@ discard block  | 
                                                    ||
| 98 | 98 | return static::$managedModelKey;  | 
                                                        
| 99 | 99 | }  | 
                                                        
| 100 | 100 | |
| 101 | -        throw new \Exception('Missing required static property \'managedModelKey\' on ' . static::class . '.'); | 
                                                        |
| 101 | +        throw new \Exception('Missing required static property \'managedModelKey\' on '.static::class.'.'); | 
                                                        |
| 102 | 102 | }  | 
                                                        
| 103 | 103 | |
| 104 | 104 | /**  | 
                                                        
@@ -138,9 +138,9 @@ discard block  | 
                                                    ||
| 138 | 138 | public function modelReferenceLabel(): string  | 
                                                        
| 139 | 139 |      { | 
                                                        
| 140 | 140 |          if ($this->exists) { | 
                                                        
| 141 | - $status = !$this->isPublished() ? ' [' . $this->statusAsPlainLabel() . ']' : null;  | 
                                                        |
| 141 | + $status = !$this->isPublished() ? ' ['.$this->statusAsPlainLabel().']' : null;  | 
                                                        |
| 142 | 142 | |
| 143 | - return $this->title ? $this->title . $status : '';  | 
                                                        |
| 143 | + return $this->title ? $this->title.$status : '';  | 
                                                        |
| 144 | 144 | }  | 
                                                        
| 145 | 145 | |
| 146 | 146 | return '';  | 
                                                        
@@ -151,7 +151,7 @@ discard block  | 
                                                    ||
| 151 | 151 | $classKey = get_class($this);  | 
                                                        
| 152 | 152 |          if (property_exists($this, 'labelSingular')) { | 
                                                        
| 153 | 153 | $labelSingular = $this->labelSingular;  | 
                                                        
| 154 | -        } else { | 
                                                        |
| 154 | +        }else { | 
                                                        |
| 155 | 155 | $labelSingular = Str::singular($classKey);  | 
                                                        
| 156 | 156 | }  | 
                                                        
| 157 | 157 | |
@@ -170,7 +170,7 @@ discard block  | 
                                                    ||
| 170 | 170 | $locale = app()->getLocale();  | 
                                                        
| 171 | 171 | }  | 
                                                        
| 172 | 172 |          try { | 
                                                        
| 173 | - $memoizedKey = $this->getMorphClass() . '-' . $this->id . '-' . $locale;  | 
                                                        |
| 173 | + $memoizedKey = $this->getMorphClass().'-'.$this->id.'-'.$locale;  | 
                                                        |
| 174 | 174 | |
| 175 | 175 |              if (isset(static::$cachedUrls[$memoizedKey])) { | 
                                                        
| 176 | 176 | return static::$cachedUrls[$memoizedKey];  | 
                                                        
@@ -226,11 +226,11 @@ discard block  | 
                                                    ||
| 226 | 226 | public function statusAsLabel()  | 
                                                        
| 227 | 227 |      { | 
                                                        
| 228 | 228 |          if ($this->isPublished()) { | 
                                                        
| 229 | - return '<a href="' . $this->url() . '" target="_blank"><em>online</em></a>';  | 
                                                        |
| 229 | + return '<a href="'.$this->url().'" target="_blank"><em>online</em></a>';  | 
                                                        |
| 230 | 230 | }  | 
                                                        
| 231 | 231 | |
| 232 | 232 |          if ($this->isDraft()) { | 
                                                        
| 233 | - return '<a href="' . $this->url() . '" target="_blank" class="text-error"><em>offline</em></a>';  | 
                                                        |
| 233 | + return '<a href="'.$this->url().'" target="_blank" class="text-error"><em>offline</em></a>';  | 
                                                        |
| 234 | 234 | }  | 
                                                        
| 235 | 235 | |
| 236 | 236 |          if ($this->isArchived()) { |