where('is_active', true) ->orderByDesc('is_default') ->first(); } public function resolvedBaseUrl(): string { return $this->base_url ?: $this->driver->defaultBaseUrl(); } /** * @return array */ protected function casts(): array { return [ 'driver' => AiProviderDriver::class, 'api_key' => 'encrypted', 'is_active' => 'boolean', 'is_default' => 'boolean', ]; } }