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