Files
laravel-llm-gateway/laravel-app/app/Models/GatewayUser.php
wtrinkl bef36c7ca2 Rename project from any-llm to laravel-llm
- Remove old any-llm related files (Dockerfile, config.yml, web/, setup-laravel.sh)
- Update README.md with new Laravel LLM Gateway documentation
- Keep docker-compose.yml with laravel-llm container names
- Clean project structure for Laravel-only implementation
2025-11-18 22:05:05 +01:00

74 lines
1.5 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class GatewayUser extends Model
{
use HasFactory;
protected $table = 'gateway_users';
protected $primaryKey = 'user_id';
public $incrementing = false;
protected $keyType = 'string';
protected $fillable = [
'user_id',
'alias',
'budget_id',
'spend',
'blocked',
'metadata',
];
protected $casts = [
'metadata' => 'array',
'blocked' => 'boolean',
'spend' => 'decimal:2',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
/**
* Get the budget associated with the user.
*/
public function budget()
{
return $this->belongsTo(Budget::class, 'budget_id', 'budget_id');
}
/**
* Get the API keys for the user.
*/
public function apiKeys()
{
return $this->hasMany(ApiKey::class, 'user_id', 'user_id');
}
/**
* Get the usage logs for the user.
*/
public function usageLogs()
{
return $this->hasMany(UsageLog::class, 'user_id', 'user_id');
}
/**
* Scope a query to only include active users.
*/
public function scopeActive($query)
{
return $query->where('blocked', false);
}
/**
* Scope a query to only include blocked users.
*/
public function scopeBlocked($query)
{
return $query->where('blocked', true);
}
}