| 1 |
<?php |
| 2 |
|
| 3 |
namespace Give\Campaigns\Factories; |
| 4 |
|
| 5 |
use Exception; |
| 6 |
use Give\Campaigns\ValueObjects\CampaignGoalType; |
| 7 |
use Give\Campaigns\ValueObjects\CampaignStatus; |
| 8 |
use Give\Campaigns\ValueObjects\CampaignType; |
| 9 |
use Give\DonationForms\Models\DonationForm; |
| 10 |
use Give\Framework\Models\Factories\ModelFactory; |
| 11 |
use Give\Framework\Support\Facades\DateTime\Temporal; |
| 12 |
|
| 13 |
/** |
| 14 |
* @since 4.0.0 |
| 15 |
*/ |
| 16 |
class CampaignFactory extends ModelFactory |
| 17 |
{ |
| 18 |
/** |
| 19 |
* @inheritDoc |
| 20 |
* @throws Exception |
| 21 |
*/ |
| 22 |
public function definition(): array |
| 23 |
{ |
| 24 |
$currentDate = Temporal::getCurrentDateTime(); |
| 25 |
$createdAt = Temporal::withoutMicroseconds($currentDate); |
| 26 |
|
| 27 |
return [ |
| 28 |
'type' => CampaignType::CORE(), |
| 29 |
'title' => __('GiveWP Campaign', 'give'), |
| 30 |
'shortDescription' => __('Campaign short description', 'give'), |
| 31 |
'longDescription' => __('Campaign long description', 'give'), |
| 32 |
'goal' => 5000, |
| 33 |
'goalType' => CampaignGoalType::AMOUNT(), |
| 34 |
'status' => CampaignStatus::ACTIVE(), |
| 35 |
'logo' => '', |
| 36 |
'image' => '', |
| 37 |
'primaryColor' => '#28C77B', |
| 38 |
'secondaryColor' => '#FFA200', |
| 39 |
'createdAt' => $createdAt, |
| 40 |
'startDate' => $createdAt, |
| 41 |
'endDate' => null, |
| 42 |
]; |
| 43 |
} |
| 44 |
} |
| 45 |
|