loadViewsFrom(__DIR__ . '/../../resources/views', 'countries_state'); // Load translation $this->loadTranslationsFrom(__DIR__ . '/../../resources/lang', 'countries_state'); // 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->registerCountriesState(); $this->registerFacade(); $this->registerBindings(); //$this->registerCommands(); } /** * Register the application bindings. * * @return void */ protected function registerCountriesState() { $this->app->bind('countries_state', function($app) { return new CountriesState($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('CountriesState', 'Lavalite\CountriesState\Facades\CountriesState'); }); } /** * Register bindings for the provider. * * @return void */ public function registerBindings() { // Bind facade $this->app->bind('countries_states.countries_state', function ($app) { return $this->app->make('CountriesStates\CountriesState\CountriesState'); }); // Bind Countries to repository $this->app->bind( 'CountriesStates\CountriesState\Interfaces\CountriesRepositoryInterface', \CountriesStates\CountriesState\Repositories\Eloquent\CountriesRepository::class ); // Bind States to repository $this->app->bind( 'CountriesStates\CountriesState\Interfaces\StatesRepositoryInterface', \CountriesStates\CountriesState\Repositories\Eloquent\StatesRepository::class ); // Bind Cities to repository $this->app->bind( 'CountriesStates\CountriesState\Interfaces\CitiesRepositoryInterface', \CountriesStates\CountriesState\Repositories\Eloquent\CitiesRepository::class ); // Bind Area to repository $this->app->bind( 'CountriesStates\CountriesState\Interfaces\AreaRepositoryInterface', \CountriesStates\CountriesState\Repositories\Eloquent\AreaRepository::class ); $this->app->register(\CountriesStates\CountriesState\Providers\AuthServiceProvider::class); $this->app->register(\CountriesStates\CountriesState\Providers\RouteServiceProvider::class); $this->app->register(\CountriesStates\CountriesState\Providers\WorkflowServiceProvider::class); } /** * Merges user's and countries_state's configs. * * @return void */ protected function mergeConfig() { $this->mergeConfigFrom( __DIR__ . '/../../config/countries_state.php', 'countries_state' ); } /** * Register scaffolding command */ protected function registerCommands() { if ($this->app->runningInConsole()) { $this->commands([ Commands\MakeCountriesState::class, ]); } } /** * Get the services provided by the provider. * * @return array */ public function provides() { return ['countries_states.countries_state']; } /** * Publish resources. * * @return void */ private function publishResources() { // Publish configuration file $this->publishes([__DIR__ . '/../../config/config.php' => config_path('countries_states/countries_state.php')], 'config'); // Publish admin view $this->publishes([__DIR__ . '/../../resources/views' => base_path('resources/views/vendor/countries_state')], 'view'); // Publish language files $this->publishes([__DIR__ . '/../../resources/lang' => base_path('resources/lang/vendor/countries_state')], 'lang'); // Publish public files and assets. $this->publishes([__DIR__ . '/public/' => public_path('/')], 'public'); } }