*/ protected $fillable = [ ExternalToken::ATTRIBUTE_ACCESS_TOKEN, ExternalToken::ATTRIBUTE_PROFILE, ExternalToken::ATTRIBUTE_REFRESH_TOKEN, ]; /** * The attributes that should be hidden for serialization. * * @var list */ protected $hidden = [ ExternalToken::ATTRIBUTE_ACCESS_TOKEN, ExternalToken::ATTRIBUTE_REFRESH_TOKEN, ]; /** * The table associated with the model. * * @var string */ protected $table = ExternalToken::TABLE; /** * The primary key associated with the table. * * @var string */ protected $primaryKey = ExternalToken::ATTRIBUTE_ID; /** * Get name. * * @return string */ public function getName(): string { return strval($this->getKey()); } /** * Get subtitle. * * @return string */ public function getSubtitle(): string { return $this->externalprofile->getName(); } /** * Get the eager loads needed to the subtitle. * * @return array */ public static function getEagerLoadsForSubtitle(): array { return [ ExternalToken::RELATION_PROFILE, ]; } /** * Get the external profile that owns the external token. * * @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. * * @return BelongsToThrough */ public function user(): BelongsToThrough { return $this->belongsToThrough( User::class, ExternalProfile::class, null, '', [ User::class => ExternalProfile::ATTRIBUTE_USER, ExternalProfile::class => ExternalProfile::ATTRIBUTE_ID, ] ); } }