llmbackend/app/Models/Client.php
2024-12-04 11:24:47 +08:00

36 lines
787 B
PHP

<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Client extends Model
{
protected $table = 'clients';
protected $fillable = [
'name',
'llm_provider_id',
];
public function llmProvider(): BelongsTo
{
return $this->belongsTo(LlmProvider::class);
}
public function admins(): BelongsToMany
{
return $this->belongsToMany(Admin::class, 'admin_client')
->withTimestamp('assigned_at');
}
public function authTokens(): HasMany
{
return $this->hasMany(AuthToken::class);
}
}