sameed_editz's avatar

How to Integrate OneSignal in Laravel to Send Push Notifications to a Flutter App?

i have some questions..

How do I set up OneSignal in Laravel? What packages or libraries should I use?

is it possible to do via onesignal rest api?

currently i have tried this but failed?

OneSignalService

Route::get('/test', function () {
    $users = User::whereNotNull('onesignal_player_id')->get();

    $playerIds = $users->pluck('onesignal_player_id')->toArray();

    if (!empty($playerIds)) {
        $response = app(OneSignalService::class)->sendPush(
            "Hi there",
            "This is a test notification",
            $playerIds
        );
        dd($response);
    }
});

and i cant figure what type of token/id should i get/save from flutter? to user model?

Any guidance, code examples, or links to relevant documentation would be greatly appreciated!

1 like
0 replies

Please or to participate in this conversation.