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