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