*/ class MediaFactory extends Factory { protected $model = Media::class; public function definition(): array { return [ 'model_type' => Product::class, 'model_id' => Product::factory(), 'file_path' => 'media/'.fake()->uuid().'.jpg', 'type' => 'image', 'alt_text' => fake()->sentence(3), 'order_column' => 0, ]; } /** * Video-Media. */ public function video(): static { return $this->state(fn (array $attributes) => [ 'type' => 'video', 'file_path' => 'media/'.fake()->uuid().'.mp4', ]); } /** * PDF-Dokument. */ public function pdf(): static { return $this->state(fn (array $attributes) => [ 'type' => 'pdf', 'file_path' => 'media/'.fake()->uuid().'.pdf', ]); } }