'', 'subject' => 'Message not found.', 'entity' => '', 'entity_id' => '', 'events' => [], ]; /** * Create a new job instance. * */ public function __construct(private array $request) { } private function getSystemLog(string $message_id): ?SystemLog { return SystemLog::query() ->where('company_id', $this->invitation->company_id) ->where('type_id', SystemLog::TYPE_WEBHOOK_RESPONSE) ->whereJsonContains('log', ['MessageID' => $message_id]) ->orderBy('id', 'desc') ->first(); } private function updateSystemLog(SystemLog $system_log, array $data): void { $system_log->log = $data; $system_log->save(); } /** * Execute the job. * * * @return void */ public function handle() { MultiDB::findAndSetDbByCompanyKey($this->request['Tag']); // match companies if (array_key_exists('ToFull', $this->request)) throw new \Exception('invalid body'); $toEmails = []; foreach ($this->request['ToFull'] as $toEmailEntry) $toEmails[] = $toEmailEntry['Email']; // create expense for each company $expense = new Expense(); $expense->company_id; } // { // "FromName": "Postmarkapp Support", // "MessageStream": "inbound", // "From": "support@postmarkapp.com", // "FromFull": { // "Email": "support@postmarkapp.com", // "Name": "Postmarkapp Support", // "MailboxHash": "" // }, // "To": "\"Firstname Lastname\" ", // "ToFull": [ // { // "Email": "yourhash+SampleHash@inbound.postmarkapp.com", // "Name": "Firstname Lastname", // "MailboxHash": "SampleHash" // } // ], // "Cc": "\"First Cc\" , secondCc@postmarkapp.com>", // "CcFull": [ // { // "Email": "firstcc@postmarkapp.com", // "Name": "First Cc", // "MailboxHash": "" // }, // { // "Email": "secondCc@postmarkapp.com", // "Name": "", // "MailboxHash": "" // } // ], // "Bcc": "\"First Bcc\" , secondbcc@postmarkapp.com>", // "BccFull": [ // { // "Email": "firstbcc@postmarkapp.com", // "Name": "First Bcc", // "MailboxHash": "" // }, // { // "Email": "secondbcc@postmarkapp.com", // "Name": "", // "MailboxHash": "" // } // ], // "OriginalRecipient": "yourhash+SampleHash@inbound.postmarkapp.com", // "Subject": "Test subject", // "MessageID": "73e6d360-66eb-11e1-8e72-a8904824019b", // "ReplyTo": "replyto@postmarkapp.com", // "MailboxHash": "SampleHash", // "Date": "Fri, 1 Aug 2014 16:45:32 -04:00", // "TextBody": "This is a test text body.", // "HtmlBody": "

This is a test html body.<\/p><\/body><\/html>", // "StrippedTextReply": "This is the reply text", // "Tag": "TestTag", // "Headers": [ // { // "Name": "X-Header-Test", // "Value": "" // }, // { // "Name": "X-Spam-Status", // "Value": "No" // }, // { // "Name": "X-Spam-Score", // "Value": "-0.1" // }, // { // "Name": "X-Spam-Tests", // "Value": "DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_PASS" // } // ], // "Attachments": [ // { // "Name": "test.txt", // "Content": "VGhpcyBpcyBhdHRhY2htZW50IGNvbnRlbnRzLCBiYXNlLTY0IGVuY29kZWQu", // "ContentType": "text/plain", // "ContentLength": 45 // } // ] // } }