firstOrCreate( ['idempotencyKey' => $idempotencyKey], ['businessId' => $business->id, 'recipientUserId' => $userId, 'recipientCustomerId' => $customerId, 'type' => $type, 'appointmentId' => $appointmentId, 'subject' => $subject, 'bodyText' => $body, 'deepLinkPath' => $deepLinkPath], ); if ($userId) $notification->deliveries()->firstOrCreate(['channel' => NotificationChannel::InApp], ['status' => 'SENT', 'sentAt' => now()]); return $notification; } }