them log, chinh upload
Some checks failed
Tests / PHP 8.3 (push) Has been cancelled
Tests / PHP 8.4 (push) Has been cancelled
Tests / PHP 8.5 (push) Has been cancelled

This commit is contained in:
2026-05-09 11:00:59 +00:00
parent 96e1ce4f40
commit efa97b6c71
33 changed files with 1055 additions and 47 deletions

View File

@@ -90,6 +90,10 @@ class EditFeedback extends EditRecord
continue;
}
if ($feedback->attachments()->where('path', $path)->exists()) {
continue;
}
$feedback->attachments()->create([
'uuid' => (string) \Illuminate\Support\Str::uuid(),
'user_id' => $sender->id,
@@ -97,8 +101,8 @@ class EditFeedback extends EditRecord
'path' => $path,
'disk' => 'public',
'collection' => 'general',
'mime_type' => $disk->mimeType($path),
'size' => $disk->size($path),
'mime_type' => $this->safeMimeType($disk, $path),
'size' => $this->safeFileSize($disk, $path),
]);
}
}
@@ -194,6 +198,10 @@ class EditFeedback extends EditRecord
continue;
}
if ($feedback->attachments()->where('path', $path)->exists()) {
continue;
}
$feedback->attachments()->create([
'uuid' => (string) \Illuminate\Support\Str::uuid(),
'user_id' => auth()->id(),
@@ -201,12 +209,30 @@ class EditFeedback extends EditRecord
'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;
}
}
protected function mutateFormDataBeforeFill(array $data): array
{
$data['is_general'] = $data['customer_product_id'] === null;