them log, chinh upload
This commit is contained in:
@@ -49,6 +49,10 @@ class CreateFeedback extends CreateRecord
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($feedback->attachments()->where('path', $path)->exists()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$feedback->attachments()->create([
|
||||
'uuid' => (string) \Illuminate\Support\Str::uuid(),
|
||||
'user_id' => auth()->id(),
|
||||
@@ -56,9 +60,27 @@ class CreateFeedback extends CreateRecord
|
||||
'path' => $path,
|
||||
'disk' => 'public',
|
||||
'collection' => $this->pendingCollection,
|
||||
'mime_type' => $disk->mimeType($path),
|
||||
'size' => $disk->size($path),
|
||||
'mime_type' => $this->safeMimeType($disk, $path),
|
||||
'size' => $this->safeFileSize($disk, $path),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
protected function safeMimeType($disk, string $path): ?string
|
||||
{
|
||||
try {
|
||||
return $disk->mimeType($path);
|
||||
} catch (\Exception $e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected function safeFileSize($disk, string $path): ?int
|
||||
{
|
||||
try {
|
||||
return $disk->size($path);
|
||||
} catch (\Exception $e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user