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