Fills the gaps between the admin panel screens and the backend: a full free-text + slide-count + language -> AI-generated presentation flow with new slide-cloning logic in TemplateFillService, a "my presentations" list endpoint, a swappable payment-gateway structure for wallet top-ups (fake driver for now), and avatar upload / public-profile toggle / account deletion / password change / notification preference endpoints. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
40 lines
982 B
PHP
40 lines
982 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\AiProviderDriver;
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Attributes\Hidden;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
#[Fillable(['name', 'driver', 'model', 'base_url', 'api_key', 'is_active', 'is_default'])]
|
|
#[Hidden(['api_key'])]
|
|
class AiProvider extends Model
|
|
{
|
|
public static function resolveActiveDefault(): ?self
|
|
{
|
|
return static::query()
|
|
->where('is_active', true)
|
|
->orderByDesc('is_default')
|
|
->first();
|
|
}
|
|
|
|
public function resolvedBaseUrl(): string
|
|
{
|
|
return $this->base_url ?: $this->driver->defaultBaseUrl();
|
|
}
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'driver' => AiProviderDriver::class,
|
|
'api_key' => 'encrypted',
|
|
'is_active' => 'boolean',
|
|
'is_default' => 'boolean',
|
|
];
|
|
}
|
|
}
|