ldc-crm/app/Http/Requests/MailjetUnsubscribeRequest.php
2021-11-05 16:26:59 +01:00

60 lines
1.7 KiB
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class MailjetUnsubscribeRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* event: the event type
* time: Unix timestamp of event
* email: email address of recipient triggering the event
* mj_campaign_id: internal Mailjet campaign ID associated to the message
* mj_contact_id: internal Mailjet contact ID
* customcampaign: value of the X-Mailjet-Campaign header when provided
* MessageID: The unique message ID
* CustomID: the custom ID, when provided at send time
* Payload: the event payload, when provided at send time
*
* {
* "event": "unsub",
* "time": 1433334941,
* "MessageID": 20547674933128000,
* "Message_GUID": "1ab23cd4-e567-8901-2345-6789f0gh1i2j",
* "email": "api@mailjet.com",
* "mj_campaign_id": 7276,
* "mj_contact_id": 126,
* "customcampaign": "",
* "CustomID": "helloworld",
* "Payload": "",
* "mj_list_id": 1,
* "ip": "127.0.0.1",
* "geo": "FR",
* "agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36"
* }
*
* @return array
*/
public function rules()
{
return [
// accept unsub request only
'event' => 'required|in:unsub',
// accept a valid email format
'email' => 'required|email',
];
}
}