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