2026-05-10 13:59:39 +03:00
|
|
|
|
<?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']);
|
2026-05-11 11:28:03 +03:00
|
|
|
|
// Default signal_type ограничен ['site','call'] — это безопасно для
|
|
|
|
|
|
// всех трёх платформ (B1 не поддерживает sms по
|
|
|
|
|
|
// chk_supplier_projects_b1_not_for_sms). Тесты, которым нужен 'sms',
|
|
|
|
|
|
// должны явно передавать ['signal_type' => 'sms'] вместе с B2/B3.
|
|
|
|
|
|
// Иначе при ->create(['platform' => 'B1']) signal_type 'sms' из
|
|
|
|
|
|
// оригинального randomElement остаётся и нарушает CHECK constraint.
|
|
|
|
|
|
$signal = fake()->randomElement(['site', 'call']);
|
2026-05-10 13:59:39 +03:00
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
|
];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|