FeaturedThemeCreated::class, 'deleted' => FeaturedThemeDeleted::class, 'restored' => FeaturedThemeRestored::class, 'updated' => FeaturedThemeUpdated::class, ]; /** * The table associated with the model. * * @var string */ protected $table = FeaturedTheme::TABLE; /** * The primary key associated with the table. * * @var string */ protected $primaryKey = FeaturedTheme::ATTRIBUTE_ID; /** * The attributes that should be cast. * * @var array */ protected $casts = [ FeaturedTheme::ATTRIBUTE_END_AT => 'datetime', FeaturedTheme::ATTRIBUTE_START_AT => 'datetime', ]; /** * Get name. * * @return string */ public function getName(): string { return Str::of($this->start_at->format(AllowedDateFormat::YMD->value)) ->append(' - ') ->append($this->end_at->format(AllowedDateFormat::YMD->value)) ->__toString(); } /** * Get the user that recommended the featured theme. * * @return BelongsTo */ public function user(): BelongsTo { return $this->belongsTo(User::class, FeaturedTheme::ATTRIBUTE_USER); } /** * Get the entry for the featured video. * * @return BelongsTo */ public function animethemeentry(): BelongsTo { return $this->belongsTo(AnimeThemeEntry::class, FeaturedTheme::ATTRIBUTE_ENTRY); } /** * Get the video to feature. * * @return BelongsTo */ public function video(): BelongsTo { return $this->belongsTo(Video::class, FeaturedTheme::ATTRIBUTE_VIDEO); } }