fcm
fcm copied to clipboard
Laravel Android Priority Error
When I add setPriority to fcm laravel throw error.
production.ERROR: syntax error, unexpected 'string' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) {"userId":1,"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): syntax error, unexpected 'string' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) at /var/www/exmaple.com/vendor/spatie/enum/src/Enum.php:31)
[stacktrace]
My code example
return FcmMessage::create()
->setData([
"content_available" => "true",
"mutable_content" => "true",
"faq_id" => (string)$this->faq->id,
'type' => (string)config('options.notification_type.question.answered'),
"created_at" => $this->faq->created_at
])
->setNotification(\NotificationChannels\Fcm\Resources\Notification::create()
->setTitle(trans('notifications.doctor_answered_question_title'))
->setBody(trans('notifications.doctor_answered_question_body', ["Name" => $this->user->name]))
)
->setAndroid(
AndroidConfig::create()
->setFcmOptions(AndroidFcmOptions::create()->setAnalyticsLabel('analytics'))
->setNotification(AndroidNotification::create()->setColor('#0A0A0A'))
->setPriority(AndroidMessagePriority::HIGH())
->setData([
"content_available" => "true",
"mutable_content" => "true",
])
)->setApns(
ApnsConfig::create()
->setFcmOptions(ApnsFcmOptions::create()->setAnalyticsLabel('analytics_ios')));