Event::factory(), 'emotion_id' => Emotion::factory(), 'task_id' => null, 'guest_name' => $this->faker->name(), 'file_path' => 'photos/' . Str::uuid() . '.jpg', 'thumbnail_path' => 'photos/thumbnails/' . Str::uuid() . '.jpg', 'likes_count' => $this->faker->numberBetween(0, 25), 'is_featured' => false, 'metadata' => ['factory' => true], ]; } public function configure(): static { return $this->afterMaking(function (Photo $photo) { if (! $photo->tenant_id && $photo->event) { $photo->tenant_id = $photo->event->tenant_id; } })->afterCreating(function (Photo $photo) { if ($photo->event && ! $photo->tenant_id) { $photo->tenant_id = $photo->event->tenant_id; $photo->save(); } if ($photo->tenant_id && $photo->event && $photo->event->tenant_id !== $photo->tenant_id) { $photo->event->update(['tenant_id' => $photo->tenant_id]); } }); } }