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