'date', 'before_photo_size' => 'integer', 'during_photo_size' => 'integer', 'after_photo_size' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime', 'deleted_at' => 'datetime', ]; public function user(): BelongsTo { return $this->belongsTo(User::class); } public function hasPhoto(string $type): bool { return !empty($this->{$type . '_photo_path'}); } public function getPhotoCount(): int { $count = 0; foreach (['before', 'during', 'after'] as $type) { if ($this->hasPhoto($type)) { $count++; } } return $count; } }