feat: implement AI styling foundation and billing scope rework
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-02-06 20:01:58 +01:00
parent df00deb0df
commit 36bed12ff9
80 changed files with 8944 additions and 49 deletions

View File

@@ -0,0 +1,60 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class AiUsageLedger extends Model
{
use HasFactory;
public const TYPE_DEBIT = 'debit';
public const TYPE_CREDIT = 'credit';
public const TYPE_REFUND = 'refund';
public const TYPE_ADJUSTMENT = 'adjustment';
protected $fillable = [
'tenant_id',
'event_id',
'request_id',
'entry_type',
'quantity',
'unit_cost_usd',
'amount_usd',
'currency',
'package_context',
'notes',
'recorded_at',
'metadata',
];
protected function casts(): array
{
return [
'unit_cost_usd' => 'decimal:5',
'amount_usd' => 'decimal:5',
'recorded_at' => 'datetime',
'metadata' => 'array',
];
}
public function tenant(): BelongsTo
{
return $this->belongsTo(Tenant::class);
}
public function event(): BelongsTo
{
return $this->belongsTo(Event::class);
}
public function request(): BelongsTo
{
return $this->belongsTo(AiEditRequest::class, 'request_id');
}
}