laravel-notification-channels / pushover

📱 Pushover notifications channel for Laravel
http://laravel-notification-channels.com
MIT License
55 stars 31 forks source link

Support for on-demand notofications? #28

Closed Kovah closed 5 years ago

Kovah commented 5 years ago

Hi there! I am pretty new to Laravel Notifications so I may also have missed a point.

I saw that notifications can be sent on-demand and wanted to do this in my application with the Pushover channel. Thing is, that I do want to send myself a notification; a single user token is supplied via the .env file as I do not want to store one single key in the database or somewhere else.

So, I thought I could just do something like

Notification::route('pushover', config('services.pushover.user_token'))
    ->notify(new SomePushoverNotification($text, $message, $priority));

but I get the following error:

Illuminate\Contracts\Container\BindingResolutionException:
Unresolvable dependency resolving [Parameter #1 [ <required> $token ]] in class NotificationChannels\Pushover\Pushover

Sound like the token is not being handed to the Pushover Channel or something?

However, using the Pushover channel for the laravel-backup package works fine, which uses a custom notifiable class that has just a routeNotificationForPushover method:

public function routeNotificationForPushover()
{
    return PushoverReceiver::withUserKey(config('services.pushover.user_token'));
}

What am I doing wrong? :/

casperboone commented 5 years ago

Hi Kovah,

You need to set an application token first, see: https://github.com/laravel-notification-channels/pushover#setting-up-your-pushover-account

Kovah commented 5 years ago

Hi. The application token is set in the config as described in the setup guide. The Pushover channel works fine for the laravel-backup package, but not for my own implementation using the Notification facade.

casperboone commented 5 years ago

Hi @Kovah,

Were you able to fix the issue? :)

Kovah commented 5 years ago

I did not work a lot on the corresponding project, but can't remember solving this. However, seems I used regular notifications for the tasks, so this may be closed.