@@ -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 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | return $this->indexPagination($builder); |
88 | 88 | } |
89 | 89 | |
90 | - return $builder->get()->map(function ($model) { |
|
90 | + return $builder->get()->map(function($model) { |
|
91 | 91 | return (new static($this->registration))->manage($model); |
92 | 92 | }); |
93 | 93 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | { |
116 | 116 | $paginator = $builder->paginate($this->pageCount); |
117 | 117 | |
118 | - $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function ($model) { |
|
118 | + $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function($model) { |
|
119 | 119 | return (new static($this->registration))->manage($model); |
120 | 120 | }); |
121 | 121 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | public function guard($verb): Manager |
194 | 194 | { |
195 | - if (! $this->can($verb)) { |
|
195 | + if (!$this->can($verb)) { |
|
196 | 196 | NotAllowedManagerRoute::notAllowedVerb($verb, $this); |
197 | 197 | } |
198 | 198 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $fields = $this->fields(); |
216 | 216 | |
217 | 217 | foreach ($this->assistants() as $assistant) { |
218 | - if (! method_exists($assistant, 'fields')) { |
|
218 | + if (!method_exists($assistant, 'fields')) { |
|
219 | 219 | continue; |
220 | 220 | } |
221 | 221 | |
@@ -241,11 +241,11 @@ discard block |
||
241 | 241 | |
242 | 242 | public function delete() |
243 | 243 | { |
244 | - if($this->model instanceof ActsAsChild) { |
|
244 | + if ($this->model instanceof ActsAsChild) { |
|
245 | 245 | $this->model->detachAllParentRelations(); |
246 | 246 | } |
247 | 247 | |
248 | - if($this->model instanceof ActsAsParent) { |
|
248 | + if ($this->model instanceof ActsAsParent) { |
|
249 | 249 | $this->model->detachAllChildRelations(); |
250 | 250 | } |
251 | 251 | |
@@ -305,9 +305,9 @@ discard block |
||
305 | 305 | static::$bootedTraitMethods[$baseMethod] = []; |
306 | 306 | |
307 | 307 | foreach (class_uses_recursive($class) as $trait) { |
308 | - $method = class_basename($trait) . ucfirst($baseMethod); |
|
308 | + $method = class_basename($trait).ucfirst($baseMethod); |
|
309 | 309 | |
310 | - if (method_exists($class, $method) && ! in_array($method, static::$bootedTraitMethods[$baseMethod])) { |
|
310 | + if (method_exists($class, $method) && !in_array($method, static::$bootedTraitMethods[$baseMethod])) { |
|
311 | 311 | static::$bootedTraitMethods[$baseMethod][] = lcfirst($method); |
312 | 312 | } |
313 | 313 | } |