Implmenting notification channel
— Laravel — 1 min read
This is private package so you can’t get this.
Navigate to config/services.php adding:
The directory tree
Making the directory, for example, packages/cp/sybase-notification-channel.
Initial composer package settings, the tips are autoload and autoload-dev to load the classes, and automatic discover the service provider. Next, set mainly properties:
You need to make provider
SybaseChannelServiceProvider and move to
cp/sybase-notification-channel changing the namespace to
Navigate to up root, set repositories path to load it and convenience development:
If you want to real test(the mean is sending for real), you can create a new laravel project and package directory put inside, and you need to load via repositories path:
composer require cp/sybase-notification-channel and
composer dump should be seeing
The mean is discover the service provider.
SybaseChannel Service Provider
Why need construct Guzzle client?
We can mock it easily for testing, by the way config properties too.
configure specific test directory
SybaseMessage testing and methods
we need to make message to set subject and content, it’s pretty simple
SybaseChannel testing and methods
set up testing
Next, we put in the test case:
And dummy Notifiable and Notification
$notifiable->routeNotificationFor('sybase', $notification) will be check if your class use notifiable trait and implement method routeNotificationForSybase it will be replace property.
See in RoutesNotifications .
...or use Notifiable