|
3 | 3 | namespace Coderflex\LaravelSendy\DTOs;
|
4 | 4 |
|
5 | 5 | use Spatie\LaravelData\Data;
|
| 6 | +use Spatie\LaravelData\Support\Validation\ValidationContext; |
6 | 7 |
|
7 | 8 | class CompaignDTO extends Data
|
8 | 9 | {
|
9 | 10 | public function __construct(
|
10 |
| - // |
| 11 | + public string $from_name, |
| 12 | + public string $from_email, |
| 13 | + public string $reply_to, |
| 14 | + public string $title, |
| 15 | + public string $subject, |
| 16 | + public ?string $plain_text, |
| 17 | + public string $html_text, |
| 18 | + public string $list_ids, |
| 19 | + public string $segment_ids, |
| 20 | + public ?string $exclude_list_ids, |
| 21 | + public ?string $exclude_segment_ids, |
| 22 | + public string $brand_id, |
| 23 | + public ?string $query_string, |
| 24 | + public ?int $track_opens, |
| 25 | + public ?int $track_clicks, |
| 26 | + public ?int $send_compaign, |
| 27 | + public ?string $schedule_date_time, |
| 28 | + public ?string $schedule_timezone, |
11 | 29 | ) {}
|
| 30 | + |
| 31 | + public static function rules(ValidationContext $context): array |
| 32 | + { |
| 33 | + return [ |
| 34 | + 'from_name' => ['required', 'string'], |
| 35 | + 'from_email' => ['required', 'email'], |
| 36 | + 'reply_to' => ['required', 'email'], |
| 37 | + 'title' => ['required', 'string'], |
| 38 | + 'subject' => ['required', 'string'], |
| 39 | + 'plain_text' => ['string', 'nullable'], |
| 40 | + 'html_text' => ['required', 'string'], |
| 41 | + 'list_ids' => ['required', 'string'], |
| 42 | + 'segment_ids' => ['required', 'string'], |
| 43 | + 'exclude_list_ids' => ['string', 'nullable'], |
| 44 | + 'exclude_segment_ids' => ['string', 'nullable'], |
| 45 | + 'brand_id' => ['required', 'string'], |
| 46 | + 'query_string' => ['string', 'nullable'], |
| 47 | + 'track_opens' => ['integer', 'nullable', 'in:0,1,2'], |
| 48 | + 'track_clicks' => ['integer', 'nullable', 'in:0,1,2'], |
| 49 | + 'send_compaign' => ['integer', 'nullable', 'in:0,1'], |
| 50 | + 'schedule_date_time' => ['date', 'nullable'], |
| 51 | + 'schedule_timezone' => ['date', 'nullable'], |
| 52 | + ]; |
| 53 | + } |
12 | 54 | }
|
0 commit comments