37 lines
852 B
PHP
37 lines
852 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Enums\SmsSendStatus;
|
|
use App\Models\Coupon;
|
|
use App\Models\SmsCampaign;
|
|
use App\Models\SmsSendLog;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<SmsSendLog>
|
|
*/
|
|
class SmsSendLogFactory extends Factory
|
|
{
|
|
protected $model = SmsSendLog::class;
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
$campaign = SmsCampaign::factory()->create();
|
|
$coupon = Coupon::factory()->create();
|
|
|
|
return [
|
|
'sms_campaign_id' => $campaign->id,
|
|
'coupon_id' => $coupon->id,
|
|
'phone' => $coupon->phone,
|
|
'message' => $campaign->message,
|
|
'status' => SmsSendStatus::Pending,
|
|
'error_message' => null,
|
|
'attempted_at' => null,
|
|
];
|
|
}
|
|
}
|