How to access the notifier within a controller?
kamsamnida opened this issue · 6 comments
Hi! I am trying to use this package within a controller like so:
use NunoMaduro\LaravelDesktopNotifier;
Looking at the source code for LDN I see a boot() function which sets up the function notify() within the service provider. So when I call notify() with options I get this error:
Call to undefined function App\Http\Controllers\notify()
So notify isn't being imported as I expected, wondering exactly how I can access this!
Also, thanks for your work, super lovely code to read, thanks!
P.S. Using laravel 5.6. Thanks!
Hey @kamsamnida .
You shouldn't use the notifier on the controller. The method exists to be used on artisan commands only, and only notifies the user that is using the artisan cli tool.
Why you need to use this on the controller?
I'd basically like to check if something has happened for a user and then send a notification to the desktop. If this isn't the right package for that, can you suggest something that might help me out? Thanks!
You need to send him a notification to the desktop?
Correct.
@kamsamnida I am sorry. This package can only notify the Operating System where the Laravel app is running.
You may want to check: https://pusher.com/tutorials/desktop-notifications-laravel
Appreciate the help and I'll definitely take a look into this!