*/ protected $fillable = [ ExternalToken::ATTRIBUTE_ACCESS_TOKEN, ExternalToken::ATTRIBUTE_PROFILE, ExternalToken::ATTRIBUTE_REFRESH_TOKEN, ]; /** * The event map for the model. * * Allows for object-based events for native Eloquent events. * * @var array */ protected $dispatchesEvents = [ 'created' => ExternalTokenCreated::class, 'deleted' => ExternalTokenDeleted::class, 'restored' => ExternalTokenRestored::class, 'updated' => ExternalTokenUpdated::class, ]; /** * 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 route key for the model. * * @return string * * @noinspection PhpMissingParentCallCommonInspection */ public function getRouteKeyName(): string { return ExternalToken::ATTRIBUTE_ID; } /** * 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, ] ); } }