loadViewsFrom(__DIR__ . '/../../resources/views', 'news'); // Load translation $this->loadTranslationsFrom(__DIR__ . '/../../resources/lang', 'news'); // 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->registerNews(); $this->registerFacade(); $this->registerBindings(); //$this->registerCommands(); } /** * Register the application bindings. * * @return void */ protected function registerNews() { $this->app->bind('news', function($app) { return new News($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('News', 'Lavalite\News\Facades\News'); }); } /** * Register bindings for the provider. * * @return void */ public function registerBindings() { // Bind facade $this->app->bind('un-ocd.news', function ($app) { return $this->app->make('UnOcd\News\News'); }); // Bind Set to repository $this->app->bind( 'UnOcd\News\Interfaces\SetRepositoryInterface', \UnOcd\News\Repositories\Eloquent\SetRepository::class ); // Bind Test2 to repository $this->app->bind( 'UnOcd\News\Interfaces\Test2RepositoryInterface', \UnOcd\News\Repositories\Eloquent\Test2Repository::class ); $this->app->register(\UnOcd\News\Providers\AuthServiceProvider::class); $this->app->register(\UnOcd\News\Providers\RouteServiceProvider::class); } /** * Merges user's and news's configs. * * @return void */ protected function mergeConfig() { $this->mergeConfigFrom( __DIR__ . '/../../config/news.php', 'news' ); } /** * Register scaffolding command */ protected function registerCommands() { if ($this->app->runningInConsole()) { $this->commands([ Commands\MakeNews::class, ]); } } /** * Get the services provided by the provider. * * @return array */ public function provides() { return ['un-ocd.news']; } /** * Publish resources. * * @return void */ private function publishResources() { // Publish configuration file $this->publishes([__DIR__ . '/../../config/config.php' => config_path('un-ocd/news.php')], 'config'); // Publish admin view $this->publishes([__DIR__ . '/../../resources/views' => base_path('resources/views/vendor/news')], 'view'); // Publish language files $this->publishes([__DIR__ . '/../../resources/lang' => base_path('resources/lang/vendor/news')], 'lang'); // Publish public files and assets. $this->publishes([__DIR__ . '/public/' => public_path('/')], 'public'); } }