@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | if (is_string($file)) { |
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 | $asset = app(AddAsset::class)->add($model, $file, $type, $locale, $this->sluggifyFilename($image_name)); |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | // New files are passed with their filename (instead of their id) |
121 | 121 | // For new files we will replace the filename with the id. |
122 | 122 | if (false !== ($key = array_search($image_name, $files_order))) { |
123 | - $files_order[$key] = (string) $asset->id; |
|
123 | + $files_order[$key] = (string)$asset->id; |
|
124 | 124 | } |
125 | - } else { |
|
125 | + }else { |
|
126 | 126 | $file = Asset::findOrFail($file); |
127 | 127 | $asset = app(AddAsset::class)->add($model, $file, $type, $locale); |
128 | 128 | } |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | */ |
136 | 136 | private function sluggifyFilename($filename): string |
137 | 137 | { |
138 | - $extension = substr($filename, strrpos($filename, '.') + 1); |
|
138 | + $extension = substr($filename, strrpos($filename, '.')+1); |
|
139 | 139 | $filename = substr($filename, 0, strrpos($filename, '.')); |
140 | - $filename = Str::slug($filename) . '.' . $extension; |
|
140 | + $filename = Str::slug($filename).'.'.$extension; |
|
141 | 141 | |
142 | 142 | return $filename; |
143 | 143 | } |
@@ -153,9 +153,9 @@ discard block |
||
153 | 153 | if ($file instanceof UploadedFile && !$file->isValid()) { |
154 | 154 | if ($file->getError() == UPLOAD_ERR_INI_SIZE) { |
155 | 155 | throw new FileTooBigException( |
156 | - 'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. ' . |
|
157 | - 'upload_max_filesize: ' . (int)ini_get('upload_max_filesize') . 'MB, ' . |
|
158 | - 'post_max_size: ' . (int)(ini_get('post_max_size')) . 'MB' |
|
156 | + 'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. '. |
|
157 | + 'upload_max_filesize: '.(int)ini_get('upload_max_filesize').'MB, '. |
|
158 | + 'post_max_size: '.(int)(ini_get('post_max_size')).'MB' |
|
159 | 159 | ); |
160 | 160 | } |
161 | 161 | } |
@@ -169,16 +169,16 @@ discard block |
||
169 | 169 | foreach ($files_by_type as $type => $files) { |
170 | 170 | foreach ($files as $locale => $_files) { |
171 | 171 | if (!in_array($locale, config('translatable.locales'))) { |
172 | - throw new \InvalidArgumentException('Corrupt file payload. key is expected to be a valid locale [' . implode(',', config('translatable.locales', [])). ']. Instead [' . $locale . '] is given.'); |
|
172 | + throw new \InvalidArgumentException('Corrupt file payload. key is expected to be a valid locale ['.implode(',', config('translatable.locales', [])).']. Instead ['.$locale.'] is given.'); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | if (!is_array($_files)) { |
176 | - throw new \InvalidArgumentException('A valid files entry should be an array of files, key with either [new, replace or delete]. Instead a ' . gettype($_files) . ' is given.'); |
|
176 | + throw new \InvalidArgumentException('A valid files entry should be an array of files, key with either [new, replace or delete]. Instead a '.gettype($_files).' is given.'); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | foreach ($_files as $action => $file) { |
180 | 180 | if (!in_array($action, $actions)) { |
181 | - throw new \InvalidArgumentException('A valid files entry should have a key of either ['.implode(',', $actions).']. Instead ' . $action . ' is given.'); |
|
181 | + throw new \InvalidArgumentException('A valid files entry should have a key of either ['.implode(',', $actions).']. Instead '.$action.' is given.'); |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | } |