Skip to content

Commit

Permalink
[5.8] Use Facade::resolved() before extending channel
Browse files Browse the repository at this point in the history
This allow slack notification to only be loaded when/if the notification is resolved. Based on PR made to laravel/framework#26824
  • Loading branch information
jake-wilson36 committed Jan 6, 2019
1 parent eb84eb0 commit 3390acf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/SlackChannelServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use GuzzleHttp\Client as HttpClient;
use Illuminate\Support\ServiceProvider;
use Illuminate\Notifications\ChannelManager;
use Illuminate\Support\Facades\Notification;

class SlackChannelServiceProvider extends ServiceProvider
Expand All @@ -15,8 +16,10 @@ class SlackChannelServiceProvider extends ServiceProvider
*/
public function register()
{
Notification::extend('slack', function ($app) {
return new Channels\SlackWebhookChannel(new HttpClient);
Notification::resolved(function (ChannelManager $service) {
$service->extend('slack', function ($app) {
return new Channels\SlackWebhookChannel(new HttpClient);
});
});
}
}

0 comments on commit 3390acf

Please sign in to comment.