loadViewsFrom(__DIR__ . '/../../resources/views', 'push_notification'); // Load translation $this->loadTranslationsFrom(__DIR__ . '/../../resources/lang', 'push_notification'); // Load migrations $this->loadMigrationsFrom(__DIR__ . '/../../database/migrations'); // Call pblish redources function $this->publishResources(); } /** * Register the service provider. * * @return void */ public function register() { $this->mergeConfig(); $this->registerPushNotification(); $this->registerFacade(); $this->registerBindings(); //$this->registerCommands(); } /** * Register the application bindings. * * @return void */ protected function registerPushNotification() { $this->app->bind('push_notification', function($app) { return new PushNotification($app); }); } /** * Register the vault facade without the user having to add it to the app.php file. * * @return void */ public function registerFacade() { $this->app->booting(function() { $loader = \Illuminate\Foundation\AliasLoader::getInstance(); $loader->alias('PushNotification', 'Lavalite\PushNotification\Facades\PushNotification'); }); } /** * Register bindings for the provider. * * @return void */ public function registerBindings() { // Bind facade $this->app->bind('location.push_notification', function ($app) { return $this->app->make('Location\PushNotification\PushNotification'); }); // Bind PushNotification to repository $this->app->bind( 'Location\PushNotification\Interfaces\PushNotificationRepositoryInterface', \Location\PushNotification\Repositories\Eloquent\PushNotificationRepository::class ); $this->app->register(\Location\PushNotification\Providers\AuthServiceProvider::class); $this->app->register(\Location\PushNotification\Providers\RouteServiceProvider::class); } /** * Merges user's and push_notification's configs. * * @return void */ protected function mergeConfig() { $this->mergeConfigFrom( __DIR__ . '/../../config/config.php', 'location.push_notification' ); } /** * Register scaffolding command */ protected function registerCommands() { if ($this->app->runningInConsole()) { $this->commands([ Commands\MakePushNotification::class, ]); } } /** * Get the services provided by the provider. * * @return array */ public function provides() { return ['location.push_notification']; } /** * Publish resources. * * @return void */ private function publishResources() { // Publish configuration file $this->publishes([__DIR__ . '/../../config/config.php' => config_path('location/push_notification.php')], 'config'); // Publish admin view $this->publishes([__DIR__ . '/../../resources/views' => base_path('resources/views/vendor/push_notification')], 'view'); // Publish language files $this->publishes([__DIR__ . '/../../resources/lang' => base_path('resources/lang/vendor/push_notification')], 'lang'); // Publish public files and assets. $this->publishes([__DIR__ . '/public/' => public_path('/')], 'public'); } }