EnclosureCast::class, 'metadata' => EpisodeMetadataCast::class, 'pub_date' => 'datetime', ]; protected $with = ['podcast']; protected static function booted(): void { static::creating(static fn (self $episode) => $episode->id = self::ID_PREFIX . Str::uuid()->toString()); } public function podcast(): BelongsTo { return $this->belongsTo(Podcast::class); } /** @inheritDoc */ public function toSearchableArray(): array { return [ 'id' => $this->id, 'title' => $this->title, 'description' => $this->metadata->description, ]; } public static function isValidId(string $value): bool { return Str::startsWith($value, self::ID_PREFIX) && Uuid::isValid(Str::after($value, self::ID_PREFIX)); } }