33 خطوط
1.0 KiB
PHP
33 خطوط
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Modules\Subscriptions\Domain;
|
|
|
|
use App\Modules\Organizations\Domain\Organization;
|
|
use Illuminate\Database\Eloquent\Concerns\HasUlids;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class Subscription extends Model
|
|
{
|
|
use HasUlids;
|
|
|
|
protected $fillable = [
|
|
'organization_id', 'plan_key', 'status', 'starts_at', 'expires_at', 'seat_limit',
|
|
'storage_quota_bytes', 'storage_used_bytes', 'ai_credit_quota', 'ai_credits_used', 'enabled_features', 'metadata',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'starts_at' => 'immutable_datetime', 'expires_at' => 'immutable_datetime',
|
|
'seat_limit' => 'integer', 'storage_quota_bytes' => 'integer', 'storage_used_bytes' => 'integer',
|
|
'ai_credit_quota' => 'integer', 'ai_credits_used' => 'integer', 'enabled_features' => 'array', 'metadata' => 'array',
|
|
];
|
|
}
|
|
|
|
public function organization(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Organization::class);
|
|
}
|
|
}
|