@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | return $this->indexPagination($builder); |
85 | 85 | } |
86 | 86 | |
87 | - return $builder->get()->map(function ($model) { |
|
87 | + return $builder->get()->map(function($model) { |
|
88 | 88 | return (new static($this->registration))->manage($model); |
89 | 89 | }); |
90 | 90 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | { |
113 | 113 | $paginator = $builder->paginate($this->pageCount); |
114 | 114 | |
115 | - $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function ($model) { |
|
115 | + $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function($model) { |
|
116 | 116 | return (new static($this->registration))->manage($model); |
117 | 117 | }); |
118 | 118 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | |
187 | 187 | public function guard($verb): Manager |
188 | 188 | { |
189 | - if (! $this->can($verb)) { |
|
189 | + if (!$this->can($verb)) { |
|
190 | 190 | NotAllowedManagerRoute::notAllowedVerb($verb, $this); |
191 | 191 | } |
192 | 192 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $fields = $this->fields(); |
210 | 210 | |
211 | 211 | foreach ($this->assistants() as $assistant) { |
212 | - if (! method_exists($assistant, 'fields')) { |
|
212 | + if (!method_exists($assistant, 'fields')) { |
|
213 | 213 | continue; |
214 | 214 | } |
215 | 215 | |
@@ -291,9 +291,9 @@ discard block |
||
291 | 291 | static::$bootedTraitMethods[$baseMethod] = []; |
292 | 292 | |
293 | 293 | foreach (class_uses_recursive($class) as $trait) { |
294 | - $method = class_basename($trait) . ucfirst($baseMethod); |
|
294 | + $method = class_basename($trait).ucfirst($baseMethod); |
|
295 | 295 | |
296 | - if (method_exists($class, $method) && ! in_array($method, static::$bootedTraitMethods[$baseMethod])) { |
|
296 | + if (method_exists($class, $method) && !in_array($method, static::$bootedTraitMethods[$baseMethod])) { |
|
297 | 297 | static::$bootedTraitMethods[$baseMethod][] = lcfirst($method); |
298 | 298 | } |
299 | 299 | } |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | if (isset(json_decode($file)->output)) { |
114 | 114 | $image_name = json_decode($file)->output->name; |
115 | 115 | $asset = app(AddAsset::class)->add($model, json_decode($file)->output->image, $type, $locale, $this->sluggifyFilename($image_name)); |
116 | - } else { |
|
117 | - if($file instanceof UploadedFile) |
|
116 | + }else { |
|
117 | + if ($file instanceof UploadedFile) |
|
118 | 118 | { |
119 | 119 | $image_name = $file->getClientOriginalName(); |
120 | 120 | $asset = app(AddAsset::class)->add($model, $file, $type, $locale, $this->sluggifyFilename($image_name)); |
@@ -122,13 +122,13 @@ discard block |
||
122 | 122 | // New files are passed with their filename (instead of their id) |
123 | 123 | // For new files we will replace the filename with the id. |
124 | 124 | if (false !== ($key = array_search($image_name, $files_order))) { |
125 | - $files_order[$key] = (string) $asset->id; |
|
125 | + $files_order[$key] = (string)$asset->id; |
|
126 | 126 | } |
127 | - }else{ |
|
128 | - try{ |
|
127 | + }else { |
|
128 | + try { |
|
129 | 129 | $file = Asset::findOrFail($file); |
130 | 130 | $asset = app(AddAsset::class)->add($model, $file, $type, $locale); |
131 | - }catch(AssetUploadException $e) |
|
131 | + } catch (AssetUploadException $e) |
|
132 | 132 | { |
133 | 133 | } |
134 | 134 | } |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | */ |
142 | 142 | private function sluggifyFilename($filename): string |
143 | 143 | { |
144 | - $extension = substr($filename, strrpos($filename, '.') + 1); |
|
144 | + $extension = substr($filename, strrpos($filename, '.')+1); |
|
145 | 145 | $filename = substr($filename, 0, strrpos($filename, '.')); |
146 | - $filename = Str::slug($filename) . '.' . $extension; |
|
146 | + $filename = Str::slug($filename).'.'.$extension; |
|
147 | 147 | |
148 | 148 | return $filename; |
149 | 149 | } |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | if ($file instanceof UploadedFile && !$file->isValid()) { |
160 | 160 | if ($file->getError() == UPLOAD_ERR_INI_SIZE) { |
161 | 161 | throw new FileTooBigException( |
162 | - 'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. ' . |
|
163 | - 'upload_max_filesize: ' . (int)ini_get('upload_max_filesize') . 'MB, ' . |
|
164 | - 'post_max_size: ' . (int)(ini_get('post_max_size')) . 'MB' |
|
162 | + 'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. '. |
|
163 | + 'upload_max_filesize: '.(int)ini_get('upload_max_filesize').'MB, '. |
|
164 | + 'post_max_size: '.(int)(ini_get('post_max_size')).'MB' |
|
165 | 165 | ); |
166 | 166 | } |
167 | 167 | } |
@@ -175,16 +175,16 @@ discard block |
||
175 | 175 | foreach ($files_by_type as $type => $files) { |
176 | 176 | foreach ($files as $locale => $_files) { |
177 | 177 | if (!in_array($locale, config('translatable.locales'))) { |
178 | - throw new \InvalidArgumentException('Corrupt file payload. key is expected to be a valid locale [' . implode(',', config('translatable.locales', [])). ']. Instead [' . $locale . '] is given.'); |
|
178 | + throw new \InvalidArgumentException('Corrupt file payload. key is expected to be a valid locale ['.implode(',', config('translatable.locales', [])).']. Instead ['.$locale.'] is given.'); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | if (!is_array($_files)) { |
182 | - 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.'); |
|
182 | + 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.'); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | foreach ($_files as $action => $file) { |
186 | 186 | if (!in_array($action, $actions)) { |
187 | - throw new \InvalidArgumentException('A valid files entry should have a key of either ['.implode(',', $actions).']. Instead ' . $action . ' is given.'); |
|
187 | + throw new \InvalidArgumentException('A valid files entry should have a key of either ['.implode(',', $actions).']. Instead '.$action.' is given.'); |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 | } |
@@ -124,11 +124,11 @@ |
||
124 | 124 | if (false !== ($key = array_search($image_name, $files_order))) { |
125 | 125 | $files_order[$key] = (string) $asset->id; |
126 | 126 | } |
127 | - }else{ |
|
127 | + } else{ |
|
128 | 128 | try{ |
129 | 129 | $file = Asset::findOrFail($file); |
130 | 130 | $asset = app(AddAsset::class)->add($model, $file, $type, $locale); |
131 | - }catch(AssetUploadException $e) |
|
131 | + } catch(AssetUploadException $e) |
|
132 | 132 | { |
133 | 133 | } |
134 | 134 | } |