Files
portal/app/database/factories/SupplierLeadFactory.php
T
Дмитрий aa37f4cbed feat(models): SupplierLead model + factory (raw-payload incoming webhooks)
SaaS-level модель для supplier_leads (Plan 2/5 Task 2).
belongsTo(SupplierProject) + array cast на raw_payload + datetime *_at.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 18:24:45 +03:00

45 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Models\SupplierLead;
use App\Models\SupplierProject;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<SupplierLead>
*/
class SupplierLeadFactory extends Factory
{
protected $model = SupplierLead::class;
public function definition(): array
{
$platform = $this->faker->randomElement(['B1', 'B2', 'B3']);
$vid = $this->faker->unique()->numberBetween(100_000_000, 999_999_999);
$phone = '7'.$this->faker->numerify('##########');
return [
'supplier_project_id' => SupplierProject::factory(),
'platform' => $platform,
'raw_payload' => [
'vid' => $vid,
'project' => $platform.'_test.example.com',
'tag' => 'test-tag',
'phone' => $phone,
'phones' => [$phone],
'time' => now()->getTimestamp(),
],
'vid' => $vid,
'phone' => $phone,
'received_at' => now(),
'source' => 'webhook',
'processed_at' => null,
'deals_created_count' => null,
'error' => null,
];
}
}