62aa55f033
- app/Models/SupplierProject.php — fillable + casts (jsonb arrays + datetime) + scopes: active() (inactive_since IS NULL), staleSince(N days), forSignal(signal_type, unique_key) - database/factories/SupplierProjectFactory.php — корректно учитывает chk_supplier_projects_b1_not_for_sms (B1 не порождает SMS-проекты) - tests/Feature/Models/SupplierProjectTest.php — 6 тестов: factory, array casts (workdays + regions), scopeActive, scopeStaleSince, scopeForSignal (3 платформы на один домен — UNIQUE (platform,unique_key)) ide-helper:models -W -M -N перегенерил docblocks для 4 существующих моделей (SaasAdminAuditLog, SystemSetting, UserRecoveryCode, ImpersonationToken) — синхронизировал @property после schema v8.16. Pest: 451 / 449 passed / 2 skipped (было 443+6 новых от Task 6 = 449). Larastan: 0 errors. Pint: passed. Spec: §2.2 Plan: Task 6 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\SupplierProject;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<SupplierProject>
|
|
*/
|
|
class SupplierProjectFactory extends Factory
|
|
{
|
|
protected $model = SupplierProject::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
$platform = fake()->randomElement(['B1', 'B2', 'B3']);
|
|
// B1 не поддерживает СМС у поставщика (chk_supplier_projects_b1_not_for_sms).
|
|
$signal = fake()->randomElement($platform === 'B1' ? ['site', 'call'] : ['site', 'call', 'sms']);
|
|
|
|
return [
|
|
'platform' => $platform,
|
|
'signal_type' => $signal,
|
|
'unique_key' => fake()->unique()->domainName(),
|
|
'supplier_external_id' => (string) fake()->numberBetween(1_000_000, 99_999_999),
|
|
'current_limit' => 0,
|
|
'current_workdays' => [1, 2, 3, 4, 5, 6, 7],
|
|
'current_regions' => null,
|
|
'sync_status' => 'pending',
|
|
'last_synced_at' => null,
|
|
'inactive_since' => null,
|
|
];
|
|
}
|
|
}
|