47 lines
1.0 KiB
PHP
Executable File
47 lines
1.0 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property int $user_id
|
|
* @property int $input_tokens
|
|
* @property int $output_tokens
|
|
* @property int $total_tokens
|
|
* @property string|null $model
|
|
* @property string|null $provider
|
|
* @property \Illuminate\Support\Carbon|null $created_at
|
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
|
* @property-read User $user
|
|
*/
|
|
class TokenUsage extends Model
|
|
{
|
|
/** @var array<int, string> */
|
|
protected $fillable = [
|
|
'user_id',
|
|
'input_tokens',
|
|
'output_tokens',
|
|
'total_tokens',
|
|
'model',
|
|
'provider',
|
|
];
|
|
|
|
/** @var array<string, string> */
|
|
protected $casts = [
|
|
'input_tokens' => 'integer',
|
|
'output_tokens' => 'integer',
|
|
'total_tokens' => 'integer',
|
|
];
|
|
|
|
/**
|
|
* Get the user associated with this token usage.
|
|
*/
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|