040d25423d
GET /api/billing/wallet (баланс + тариф + runway), /transactions (пагинированный balance_transactions с фильтром type), /invoices (saas_invoices, real-but-empty до Б-1). TariffPlan модель + Tenant::tariff() relation + BalanceTransactionFactory. Sprint 2 Plan C, audit E3 (backend). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
55 lines
1.4 KiB
PHP
55 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* Тарифный план SaaS-портала (каталог tariff_plans).
|
|
*
|
|
* Сидится из db/schema.sql (4 стартовых плана: start/basic/pro/enterprise).
|
|
* Read-mostly: редактируется только админкой SaaS. Tenant ссылается через
|
|
* tenants.current_tariff_id (см. Tenant::tariff()).
|
|
*
|
|
* Источник: db/schema.sql §20.2.1, table `tariff_plans`.
|
|
*
|
|
* @mixin IdeHelperTariffPlan
|
|
*/
|
|
class TariffPlan extends Model
|
|
{
|
|
protected $fillable = [
|
|
'code',
|
|
'name',
|
|
'description',
|
|
'billing_model',
|
|
'price_per_lead',
|
|
'price_monthly',
|
|
'included_leads',
|
|
'limits',
|
|
'features',
|
|
'trial_bonus_leads',
|
|
'is_active',
|
|
'is_public',
|
|
'sort_order',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'price_per_lead' => 'decimal:2',
|
|
'price_monthly' => 'decimal:2',
|
|
'included_leads' => 'integer',
|
|
'limits' => 'array',
|
|
'features' => 'array',
|
|
'trial_bonus_leads' => 'integer',
|
|
'is_active' => 'boolean',
|
|
'is_public' => 'boolean',
|
|
'sort_order' => 'integer',
|
|
'created_at' => 'datetime',
|
|
'updated_at' => 'datetime',
|
|
];
|
|
}
|
|
}
|