We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| @@ 162-173 (lines=12) @@ | ||
| 159 | } |
|
| 160 | ||
| 161 | // if a new file is uploaded, store it on disk and its filename in the database |
|
| 162 | if ($request->hasFile($attribute_name) && $request->file($attribute_name)->isValid()) { |
|
| 163 | // 1. Generate a new file name |
|
| 164 | $file = $request->file($attribute_name); |
|
| 165 | $new_file_name = md5($file->getClientOriginalName().time()).'.'.$file->getClientOriginalExtension(); |
|
| 166 | ||
| 167 | // 2. Move the new file to the correct path |
|
| 168 | $file_path = $file->storeAs($destination_path, $new_file_name, $disk); |
|
| 169 | ||
| 170 | // 3. Save the complete path to the database |
|
| 171 | $this->attributes[$attribute_name] = $file_path; |
|
| 172 | } |
|
| 173 | } |
|
| 174 | ||
| 175 | /** |
|
| 176 | * Handle multiple file upload and DB storage: |
|
| @@ 209-222 (lines=14) @@ | ||
| 206 | } |
|
| 207 | ||
| 208 | // if a new file is uploaded, store it on disk and its filename in the database |
|
| 209 | if ($request->hasFile($attribute_name)) { |
|
| 210 | foreach ($request->file($attribute_name) as $file) { |
|
| 211 | if ($file->isValid()) { |
|
| 212 | // 1. Generate a new file name |
|
| 213 | $new_file_name = md5($file->getClientOriginalName().time()).'.'.$file->getClientOriginalExtension(); |
|
| 214 | ||
| 215 | // 2. Move the new file to the correct path |
|
| 216 | $file_path = $file->storeAs($destination_path, $new_file_name, $disk); |
|
| 217 | ||
| 218 | // 3. Add the public path to the database |
|
| 219 | $attribute_value[] = $file_path; |
|
| 220 | } |
|
| 221 | } |
|
| 222 | } |
|
| 223 | ||
| 224 | $this->attributes[$attribute_name] = json_encode($attribute_value); |
|
| 225 | } |
|