Files
2026-09-01 09:22:30 -03:00

54 lines
1.1 KiB
PHP
Executable File

<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class AiProvider extends Model
{
use \Illuminate\Database\Eloquent\SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'slug',
'description',
'api_key',
'base_url',
'is_active',
'config',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'is_active' => 'boolean',
'config' => 'array',
];
}
/**
* Get all of the models for the AI provider.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\App\Models\AiModel>
*/
public function models(): HasMany
{
return $this->hasMany(AiModel::class, 'provider_id');
}
}