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