HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: /home/xedaptot/ai.naniguide.com/database/factories/CampaignFactory.php
<?php

namespace Database\Factories;

use App\Model\Campaign;
use App\Model\Customer;
use App\Model\MailList;
use Illuminate\Database\Eloquent\Factories\Factory;

class CampaignFactory extends Factory
{
    protected $model = Campaign::class;

    public function definition(): array
    {
        return [
            'uid' => fake()->uuid(),
            'customer_id' => Customer::factory(),
            'name' => fake()->sentence(3),
            'type' => Campaign::TYPE_REGULAR,
            'status' => Campaign::STATUS_NEW,
            'subject' => fake()->sentence(),
            'from_email' => fake()->safeEmail(),
            'from_name' => fake()->name(),
            'reply_to' => fake()->safeEmail(),
        ];
    }

    public function withList(MailList $list): static
    {
        return $this->state([
            'mail_list_id' => $list->id,
            'customer_id' => $list->customer_id,
        ]);
    }

    public function sending(): static
    {
        return $this->state(['status' => Campaign::STATUS_SENDING]);
    }

    public function done(): static
    {
        return $this->state(['status' => Campaign::STATUS_DONE]);
    }
}