*/ protected $fillable = [ ExternalEntry::ATTRIBUTE_ANIME, ExternalEntry::ATTRIBUTE_PROFILE, ExternalEntry::ATTRIBUTE_IS_FAVORITE, ExternalEntry::ATTRIBUTE_SCORE, ExternalEntry::ATTRIBUTE_STATUS, ]; /** * Get the attributes that should be cast. * * @return array */ protected function casts(): array { return [ ExternalEntry::ATTRIBUTE_ANIME => 'int', ExternalEntry::ATTRIBUTE_PROFILE => 'int', ExternalEntry::ATTRIBUTE_IS_FAVORITE => 'bool', ExternalEntry::ATTRIBUTE_SCORE => 'float', ExternalEntry::ATTRIBUTE_STATUS => ExternalEntryStatus::class, ]; } public function getName(): string { return strval($this->getKey()); } public function getSubtitle(): string { return $this->anime->getName(); } /** * Get the fields to perform an update. * * @return string[] */ public static function fieldsForUpdate(): array { return [ ExternalEntry::ATTRIBUTE_IS_FAVORITE, ExternalEntry::ATTRIBUTE_SCORE, ExternalEntry::ATTRIBUTE_STATUS, ]; } /** * @return BelongsTo */ public function anime(): BelongsTo { return $this->belongsTo(Anime::class, ExternalEntry::ATTRIBUTE_ANIME); } /** * @return BelongsTo */ public function externalprofile(): BelongsTo { return $this->belongsTo(ExternalProfile::class, ExternalEntry::ATTRIBUTE_PROFILE); } }