Files
laravel-llm-gateway/laravel-app/app/Models/Budget.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

63 lines
1.4 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Budget extends Model
{
use HasFactory;
protected $table = 'budgets';
protected $primaryKey = 'budget_id';
public $incrementing = false;
protected $keyType = 'string';
protected $fillable = [
'budget_id',
'name',
'monthly_limit',
'daily_limit',
'created_by',
];
protected $casts = [
'monthly_limit' => 'decimal:2',
'daily_limit' => 'decimal:2',
];
/**
* Get formatted max budget display
*/
public function getMaxBudgetFormattedAttribute(): string
{
if ($this->monthly_limit) {
return '$' . number_format($this->monthly_limit, 2);
}
if ($this->daily_limit) {
return '$' . number_format($this->daily_limit, 2) . '/day';
}
return 'Unlimited';
}
/**
* Get human-readable duration
*/
public function getDurationHumanAttribute(): string
{
if ($this->monthly_limit && $this->daily_limit) {
return 'Monthly';
}
if ($this->daily_limit && !$this->monthly_limit) {
return 'Daily';
}
return 'Unlimited';
}
public function gatewayUsers()
{
return $this->hasMany(GatewayUser::class, 'budget_id', 'budget_id');
}
}