22
33namespace Coderflex \LaravelSendy \DTOs ;
44
5+ use Spatie \LaravelData \Attributes \MergeValidationRules ;
56use Spatie \LaravelData \Data ;
67use Spatie \LaravelData \Support \Validation \ValidationContext ;
78
9+ #[MergeValidationRules]
810class SubscribersDTO extends Data
911{
1012 public function __construct (
@@ -19,18 +21,11 @@ public function __construct(
1921 public ?bool $ boolean ,
2022 ) {}
2123
22- // public static function rules(ValidationContext $context): array
23- // {
24- // return [
25- // 'name' => ['string', 'nullable'],
26- // 'email' => ['required', 'string', 'email'],
27- // 'list' => ['required', 'string'],
28- // 'country' => ['string', 'nullable'],
29- // 'ipaddress' => ['string', 'nullable', 'ip'],
30- // 'referrer' => ['string', 'nullable'],
31- // 'gdpr' => ['boolean', 'nullable'],
32- // 'silent' => ['boolean', 'nullable'],
33- // 'boolean' => ['boolean', 'nullable'],
34- // ];
35- // }
24+ public static function rules (ValidationContext $ context ): array
25+ {
26+ return [
27+ 'email ' => ['email ' ],
28+ 'ipaddress ' => ['ip ' ],
29+ ];
30+ }
3631}
0 commit comments