@@ -3,7 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use Anavel\Crud\Abstractor\Eloquent\Relation\Traits\CheckRelationCompatibility; |
5 | 5 | use Anavel\Crud\Contracts\Abstractor\Field; |
6 | -use App; |
|
7 | 6 | use Illuminate\Http\Request; |
8 | 7 | |
9 | 8 | class Translation extends Relation |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | if (!empty($customDisplayedColumns) && is_array($customDisplayedColumns)) { |
135 | 135 | foreach ($customDisplayedColumns as $customColumn) { |
136 | 136 | if (!array_key_exists($customColumn, $tableColumns)) { |
137 | - throw new AbstractorException("Column " . $customColumn . " does not exist on " . $this->getModel()); |
|
137 | + throw new AbstractorException("Column ".$customColumn." does not exist on ".$this->getModel()); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | $columns[$customColumn] = $tableColumns[$customColumn]; |
@@ -316,14 +316,14 @@ discard block |
||
316 | 316 | $field = $this->fieldFactory |
317 | 317 | ->setColumn($column) |
318 | 318 | ->setConfig([ |
319 | - 'name' => $name . '__delete', |
|
319 | + 'name' => $name.'__delete', |
|
320 | 320 | 'presentation' => null, |
321 | 321 | 'form_type' => 'checkbox', |
322 | 322 | 'no_validate' => true, |
323 | 323 | 'functions' => null |
324 | 324 | ]) |
325 | 325 | ->get(); |
326 | - $fields[$arrayKey][$name . '__delete'] = $field; |
|
326 | + $fields[$arrayKey][$name.'__delete'] = $field; |
|
327 | 327 | } |
328 | 328 | } |
329 | 329 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | $config = [ |
125 | 125 | 'name' => $columnName, |
126 | - 'presentation' => $this->name . ' ' . ucfirst(transcrud($columnName)), |
|
126 | + 'presentation' => $this->name.' '.ucfirst(transcrud($columnName)), |
|
127 | 127 | 'form_type' => $formType, |
128 | 128 | 'no_validate' => true, |
129 | 129 | 'validation' => null, |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $field = $this->fieldFactory |
145 | 145 | ->setColumn($column) |
146 | 146 | ->setConfig([ |
147 | - 'name' => $columnName . '__delete', |
|
147 | + 'name' => $columnName.'__delete', |
|
148 | 148 | 'presentation' => null, |
149 | 149 | 'form_type' => 'checkbox', |
150 | 150 | 'no_validate' => true, |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | 'functions' => null |
153 | 153 | ]) |
154 | 154 | ->get(); |
155 | - $fields[$columnName . '__delete'] = $field; |
|
155 | + $fields[$columnName.'__delete'] = $field; |
|
156 | 156 | } |
157 | 157 | } |
158 | 158 | } |
@@ -196,11 +196,11 @@ discard block |
||
196 | 196 | $fieldName = $field->getName(); |
197 | 197 | |
198 | 198 | if (get_class($field->getFormField()) === \FormManager\Fields\File::class) { |
199 | - $handleResult = $this->handleField($request, $relationModel, $relation, $this->name . ".$relationIndex", $fieldName); |
|
200 | - if (! empty($handleResult['skipNext'])) { |
|
199 | + $handleResult = $this->handleField($request, $relationModel, $relation, $this->name.".$relationIndex", $fieldName); |
|
200 | + if (!empty($handleResult['skipNext'])) { |
|
201 | 201 | unset($relationArray[$relationIndex][$handleResult['skipNext']]); |
202 | 202 | } |
203 | - if (! empty($handleResult['requestValue'])) { |
|
203 | + if (!empty($handleResult['requestValue'])) { |
|
204 | 204 | $relationArray[$relationIndex][$fieldName] = $handleResult['requestValue']; |
205 | 205 | } |
206 | 206 | } |
@@ -11,18 +11,18 @@ discard block |
||
11 | 11 | { |
12 | 12 | protected function handleField(Request $request, $item, array $fields, $groupName, $fieldName) |
13 | 13 | { |
14 | - $modelFolder = $this->slug . DIRECTORY_SEPARATOR; |
|
14 | + $modelFolder = $this->slug.DIRECTORY_SEPARATOR; |
|
15 | 15 | $basePath = base_path(config('anavel-crud.uploads_path')); |
16 | - $modelPath = $basePath . $modelFolder; |
|
16 | + $modelPath = $basePath.$modelFolder; |
|
17 | 17 | $skip = null; |
18 | 18 | $requestValue = null; |
19 | - if (! empty($fields["{$fieldName}__delete"])) { |
|
19 | + if (!empty($fields["{$fieldName}__delete"])) { |
|
20 | 20 | //We never want to save this field, it doesn't exist in the DB |
21 | 21 | $skip = "{$fieldName}__delete"; |
22 | 22 | |
23 | 23 | |
24 | 24 | //If user wants to delete the existing file |
25 | - if (! empty($request->input("{$groupName}.{$fieldName}__delete"))) { |
|
25 | + if (!empty($request->input("{$groupName}.{$fieldName}__delete"))) { |
|
26 | 26 | $adapter = new Local($basePath); |
27 | 27 | $filesystem = new Filesystem($adapter); |
28 | 28 | dd($item); |
@@ -40,18 +40,18 @@ discard block |
||
40 | 40 | ]; |
41 | 41 | } |
42 | 42 | } |
43 | - if ($request->hasFile($groupName .'.'.$fieldName)) { |
|
44 | - $fileName = uniqid() . '.' . $request->file($groupName .'.'.$fieldName)->getClientOriginalExtension(); |
|
43 | + if ($request->hasFile($groupName.'.'.$fieldName)) { |
|
44 | + $fileName = uniqid().'.'.$request->file($groupName.'.'.$fieldName)->getClientOriginalExtension(); |
|
45 | 45 | |
46 | 46 | |
47 | - $request->file($groupName .'.'.$fieldName)->move( |
|
47 | + $request->file($groupName.'.'.$fieldName)->move( |
|
48 | 48 | $modelPath, |
49 | 49 | $fileName |
50 | 50 | ); |
51 | 51 | |
52 | - $requestValue = $modelFolder . $fileName; |
|
53 | - } elseif (! empty($request->file($groupName .'.'.$fieldName)) && ! $request->file($groupName .'.'.$fieldName)->isValid()) { |
|
54 | - throw new \Exception($request->file($groupName .'.'.$fieldName)->getErrorMessage()); |
|
52 | + $requestValue = $modelFolder.$fileName; |
|
53 | + } elseif (!empty($request->file($groupName.'.'.$fieldName)) && !$request->file($groupName.'.'.$fieldName)->isValid()) { |
|
54 | + throw new \Exception($request->file($groupName.'.'.$fieldName)->getErrorMessage()); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | return [ |