implement uploading file

This commit is contained in:
2026-05-01 02:02:34 +03:30
parent 4776af5c2a
commit 12b6bb4d76
11 changed files with 589 additions and 24 deletions

View File

@@ -35,4 +35,25 @@ class MessageFactory extends Factory
'edited_at' => null,
];
}
public function file(array $metadata = []): static
{
$name = $metadata['original_name'] ?? fake()->randomElement([
'project-brief.pdf',
'launch-notes.txt',
'design-review.png',
]);
return $this->state(fn (array $attributes) => [
'type' => Message::TypeFile,
'body' => $name,
'metadata' => array_merge([
'disk' => 'local',
'path' => 'chat-attachments/'.fake()->uuid().'/'.$name,
'original_name' => $name,
'mime_type' => 'application/octet-stream',
'size' => fake()->numberBetween(24_000, 2_400_000),
], $metadata),
]);
}
}