*/ class DocumentFactory extends Factory { /** * Define the model's default state. * * @return array */ public function definition(): array { $ext = $this->faker->randomElement(['pdf', 'txt', 'png', 'jpeg']); $nameBase = $this->faker->words(3, true); $fileName = $nameBase.'.'.$ext; return [ 'name' => $nameBase, 'description' => $this->faker->optional()->sentence(), 'user_id' => User::factory(), 'disk' => 'public', 'path' => 'cases/'.$this->faker->uuid().'/documents/'.$fileName, 'file_name' => $fileName, 'original_name' => $fileName, 'extension' => $ext, 'mime_type' => match ($ext) { 'pdf' => 'application/pdf', 'txt' => 'text/plain', 'png' => 'image/png', 'jpeg' => 'image/jpeg', default => 'application/octet-stream', }, 'size' => $this->faker->numberBetween(1000, 1000000), 'checksum' => null, 'is_public' => $this->faker->boolean(10), ]; } }