$this->statusToStore ? $this->statusToStore : $this->status, 'to' => $to, 'subject' => base64_encode($subject), 'content' => base64_encode($content), 'result' => $result ]; $notification = BookingNotification::create([ 'restaurant_id' => $this->restaurant->id, 'booking_id' => $this->id, 'type' => $type, 'type_id' => $type_id, 'payload' => $payload ]); $notification->save(); return $notification; } protected function updateEmailSent($notificationId, $result) { $notification = BookingNotification::find($notificationId); if ($notification) { $payload = $notification->payload; $payload['result'] = $result; $notification->payload = $payload; $notification->save(); return $notification; } return null; } }