Skip to content

Commit

Permalink
Merge pull request #4 from crynobone/patch-1
Browse files Browse the repository at this point in the history
[5.8] Use Facade::resolved() before extending channel
  • Loading branch information
taylorotwell authored Jan 6, 2019
2 parents 9b3ac5e + 3c8e8fb commit 4590d38
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/NexmoChannelServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Nexmo\Client as NexmoClient;
use Illuminate\Support\ServiceProvider;
use Illuminate\Notifications\ChannelManager;
use Illuminate\Support\Facades\Notification;
use Nexmo\Client\Credentials\Basic as NexmoCredentials;

Expand All @@ -16,14 +17,16 @@ class NexmoChannelServiceProvider extends ServiceProvider
*/
public function register()
{
Notification::extend('nexmo', function ($app) {
return new Channels\NexmoSmsChannel(
new NexmoClient(new NexmoCredentials(
$this->app['config']['services.nexmo.key'],
$this->app['config']['services.nexmo.secret']
)),
$this->app['config']['services.nexmo.sms_from']
);
Notification::resolved(function (ChannelManager $service) {
$service->extend('nexmo', function ($app) {
return new Channels\NexmoSmsChannel(
new NexmoClient(new NexmoCredentials(
$this->app['config']['services.nexmo.key'],
$this->app['config']['services.nexmo.secret']
)),
$this->app['config']['services.nexmo.sms_from']
);
});
});
}
}

0 comments on commit 4590d38

Please sign in to comment.