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