*/ protected $fillable = [ ExternalToken::ATTRIBUTE_ACCESS_TOKEN, ExternalToken::ATTRIBUTE_PROFILE, ExternalToken::ATTRIBUTE_REFRESH_TOKEN, ]; /** * Get the attributes that should be cast. * * @return array */ protected function casts(): array { return [ ExternalToken::ATTRIBUTE_ACCESS_TOKEN => 'string', ExternalToken::ATTRIBUTE_PROFILE => 'int', ExternalToken::ATTRIBUTE_REFRESH_TOKEN => 'string', ]; } public function getName(): string { return strval($this->getKey()); } public function getSubtitle(): string { return $this->externalprofile->getName(); } /** * @return BelongsTo */ public function externalprofile(): BelongsTo { return $this->belongsTo(ExternalProfile::class, ExternalToken::ATTRIBUTE_PROFILE); } /** * Get the user that owns the external token through the external profile. */ public function user(): BelongsToThrough { return $this->belongsToThrough( User::class, ExternalProfile::class, null, '', [ User::class => ExternalProfile::ATTRIBUTE_USER, ExternalProfile::class => ExternalProfile::ATTRIBUTE_ID, ] ); } }