# give/4.18.0/src/Campaigns/Factories/CampaignFactory.php

GiveWP – Donation Plugin and Fundraising Platform, version 4.18.0. 45 lines.

- Page: https://pluginprobe.com/plugins/give/4.18.0/code/src/Campaigns/Factories/CampaignFactory.php
- Raw: https://pluginprobe.com/plugins/give/4.18.0/raw/src/Campaigns/Factories/CampaignFactory.php
- Modified: 2025-05-01T11:56:08+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/give/4.18.0/code/src/Campaigns/Factories/CampaignFactory.php#L10-L20`.

```php
<?php

namespace Give\Campaigns\Factories;

use Exception;
use Give\Campaigns\ValueObjects\CampaignGoalType;
use Give\Campaigns\ValueObjects\CampaignStatus;
use Give\Campaigns\ValueObjects\CampaignType;
use Give\DonationForms\Models\DonationForm;
use Give\Framework\Models\Factories\ModelFactory;
use Give\Framework\Support\Facades\DateTime\Temporal;

/**
 * @since 4.0.0
 */
class CampaignFactory extends ModelFactory
{
    /**
     * @inheritDoc
     * @throws Exception
     */
    public function definition(): array
    {
        $currentDate = Temporal::getCurrentDateTime();
        $createdAt = Temporal::withoutMicroseconds($currentDate);

        return [
            'type' => CampaignType::CORE(),
            'title' => __('GiveWP Campaign', 'give'),
            'shortDescription' => __('Campaign short description', 'give'),
            'longDescription' => __('Campaign long description', 'give'),
            'goal' => 5000,
            'goalType' => CampaignGoalType::AMOUNT(),
            'status' => CampaignStatus::ACTIVE(),
            'logo' => '',
            'image' => '',
            'primaryColor' => '#28C77B',
            'secondaryColor' => '#FFA200',
            'createdAt' => $createdAt,
            'startDate' => $createdAt,
            'endDate' => null,
        ];
    }
}

```
