Skip to content

Commit

Permalink
Merge pull request #83 from mettle/improvement/unsubscribed-at
Browse files Browse the repository at this point in the history
[IMPROVEMENT] Set Subscriber unsubscribed_at via API
  • Loading branch information
JonoB authored Oct 9, 2020
2 parents 95f597f + 8ae915e commit c2f483a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Http/Requests/Api/SubscriberStoreRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public function rules(): array
'first_name' => ['nullable'],
'last_name' => ['nullable'],
'email' => ['required', 'email'],
'segments' => ['array', 'nullable']
'segments' => ['array', 'nullable'],
'unsubscribed_at' => ['nullable', 'date'],
];
}
}
1 change: 1 addition & 0 deletions src/Http/Requests/Api/SubscriberUpdateRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public function rules(): array
'last_name' => ['nullable'],
'email' => ['required', 'email'],
'segments' => ['nullable', 'array'],
'unsubscribed_at' => ['nullable', 'date'],
];
}
}
1 change: 1 addition & 0 deletions src/Http/Resources/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function toArray($request)
'last_name' => $this->last_name,
'email' => $this->email,
'segments' => SegmentResource::collection($this->whenLoaded('segments')),
'unsubscribed_at' => $this->unsubscribed_at ? $this->unsubscribed_at->toDateTimeString() : null,
'created_at' => $this->created_at->toDateTimeString(),
'updated_at' => $this->updated_at->toDateTimeString()
];
Expand Down

0 comments on commit c2f483a

Please # to comment.