Deekshith's avatar

Onesignal integration with laravel for web push notifications.

I have laravel website where i want to integrate onesignal push notifications. once the user opens the website it should ask for subscribe to allow for notifications then it will store user tokens in one signal dashboard. I just need to integrate a subscription channel where users subscribe for notifications by clicking allow.

I have installed below library,

https://github.com/berkayk/laravel-onesignal

but it provides the documentation only for already subscribed users. please help me out how to ask user to allow for notifications in laravel.

0 likes
3 replies
Deekshith's avatar

@lacasera In the tutorial, I found below step,

Next, you'll need to add the OneSignal SDK files to your site. To do so,

Download the OneSignal SDK files. (You can also download the files here).

Unzip the OneSignal SDK files. There should be two files:

https://yoursite.com/OneSignalSDKWorker.js https://yoursite.com/OneSignalSDKUpdaterWorker.js Upload the OneSignal SDK files to the top-level root of your site directory, making them publicly accessible.

But in laravel it is not accessible at root level as it stores in public folder.

Any solutions?

lacasera's avatar

@deekshith go on and add it to the public directory. The files need to be in a place where they are publicly accessible in your project. which in this case is the public directory

don't forget to add the code from your onesignal dashboard your blade layout.

Please or to participate in this conversation.