diff --git a/CHANGELOG.md b/CHANGELOG.md index f411393..fa42f28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -## [1.0.0] - 2017-06-18 +## [1.2.0] - 2017-07-22 ### Added -- First release +- Adds Notifier Facade ## [1.1.2] - 2017-06-27 ### Fixed - Fixed service provider namespace on readme ([#4](https://github.com/nunomaduro/laravel-desktop-notifier/pull/4)) + +## [1.0.0] - 2017-06-18 +### Added +- First release diff --git a/composer.json b/composer.json index de16a6b..e3938bf 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,10 @@ "laravel": { "providers": [ "NunoMaduro\\LaravelDesktopNotifier\\LaravelDesktopNotifierServiceProvider" - ] + ], + "aliases": { + "Notifier": "NunoMaduro\\LaravelDesktopNotifier\\Facaces\\Notifier" + } } }, "minimum-stability": "dev", diff --git a/src/Facades/Notifier.php b/src/Facades/Notifier.php new file mode 100644 index 0000000..a11c7d5 --- /dev/null +++ b/src/Facades/Notifier.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace NunoMaduro\LaravelDesktopNotifier\Facades; + +use Illuminate\Support\Facades\Facade; + +/** + * The is the Laravel Desktop Notifier facade class. + * + * @author Nuno Maduro + */ +class Notifier extends Facade +{ + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() + { + return 'desktop.notifier'; + } +} diff --git a/src/LaravelDesktopNotifierServiceProvider.php b/src/LaravelDesktopNotifierServiceProvider.php index 2b0cfc3..ae96ecf 100644 --- a/src/LaravelDesktopNotifierServiceProvider.php +++ b/src/LaravelDesktopNotifierServiceProvider.php @@ -11,10 +11,10 @@ namespace NunoMaduro\LaravelDesktopNotifier; -use Illuminate\Support\ServiceProvider; use Joli\JoliNotif\NotifierFactory; -use NunoMaduro\LaravelDesktopNotifier\Contracts\Notification as NotificationContract; +use Illuminate\Support\ServiceProvider; use NunoMaduro\LaravelDesktopNotifier\Contracts\Notifier as NotifierContract; +use NunoMaduro\LaravelDesktopNotifier\Contracts\Notification as NotificationContract; /** * The is the Laravel Desktop Notifier service provider class. @@ -30,7 +30,7 @@ class LaravelDesktopNotifierServiceProvider extends ServiceProvider */ public function register() { - $this->app->singleton(NotifierContract::class, function ($app) { + $this->app->singleton('desktop.notifier', function ($app) { $config = $app['config']['app.notifiers']; $notifier = NotifierFactory::create(is_array($config) ? $config : []); @@ -38,8 +38,12 @@ public function register() return new Notifier($notifier); }); - $this->app->bind(NotificationContract::class, function () { + $this->app->alias('desktop.notifier', NotifierContract::class); + + $this->app->bind('desktop.notification', function () { return new Notification(); }); + + $this->app->alias('desktop.notification', NotificationContract::class); } }