messaging = app('firebase.messaging'); } public function sendToToken(string $token, string $title, string $body, array $data = []) { $message = CloudMessage::withTarget('token', $token) ->withNotification(Notification::create($title, $body)) ->withData($data); return $this->messaging->send($message); } public function sendToTopic(string $topic, string $title, string $body, array $data = []) { $message = CloudMessage::withTarget('topic', $topic) ->withNotification(Notification::create($title, $body)) ->withData($data); return $this->messaging->send($message); } }