'boolean', 'scopes_granted' => 'array', 'metadata' => 'array', 'last_health_check_at' => 'datetime', ]; public function tenant(): BelongsTo { return $this->belongsTo(Tenant::class); } public function credential(): HasOne { return $this->hasOne(ProviderCredential::class, 'provider_connection_id'); } public function makeDefault(): void { DB::transaction(function (): void { static::query() ->where('tenant_id', $this->tenant_id) ->where('provider', $this->provider) ->where('is_default', true) ->whereKeyNot($this->getKey()) ->update(['is_default' => false]); static::query() ->whereKey($this->getKey()) ->update(['is_default' => true]); }); $this->refresh(); } }