loadViewsFrom(__DIR__ . '/../../resources/views', 'cart'); // Load translation $this->loadTranslationsFrom(__DIR__ . '/../../resources/lang', 'cart'); // 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->registerFacade(); $this->registerBindings(); //$this->registerCommands(); $this->app->register(\Ebuy\Cart\Providers\AuthServiceProvider::class); $this->app->register(\Ebuy\Cart\Providers\RouteServiceProvider::class); // $this->app->register(\Ebuy\Cart\Providers\EventServiceProvider::class); // $this->app->register(\Ebuy\Cart\Providers\WorkflowServiceProvider::class); } /** * Register the vault facade without the user having to add it to the app.php file. * * @return void */ public function registerFacade() { $this->app->bind('ebuy.cart', function($app) { return $this->app->make(Cart::class); }); } /** * Register the bindings for the service provider. * * @return void */ public function registerBindings() { // Bind Cart to repository $this->app->bind( 'Ebuy\Cart\Interfaces\CartRepositoryInterface', \Ebuy\Cart\Repositories\Eloquent\CartRepository::class ); // Bind Location to repository $this->app->bind( 'Ebuy\Cart\Interfaces\LocationRepositoryInterface', \Ebuy\Cart\Repositories\Eloquent\LocationRepository::class ); // Bind Shipping to repository $this->app->bind( 'Ebuy\Cart\Interfaces\ShippingRepositoryInterface', \Ebuy\Cart\Repositories\Eloquent\ShippingRepository::class ); } /** * Merges user's and cart's configs. * * @return void */ protected function mergeConfig() { $this->mergeConfigFrom( __DIR__ . '/../../config/config.php', 'ebuy.cart' ); } /** * Register scaffolding command */ protected function registerCommands() { if ($this->app->runningInConsole()) { $this->commands([ \Ebuy\Cart\Commands\Cart::class, ]); } } /** * Get the services provided by the provider. * * @return array */ public function provides() { return ['ebuy.cart']; } /** * Publish resources. * * @return void */ private function publishResources() { // Publish configuration file $this->publishes([__DIR__ . '/../../config/config.php' => config_path('ebuy/cart.php')], 'config'); // Publish admin view $this->publishes([__DIR__ . '/../../resources/views' => base_path('resources/views/vendor/cart')], 'view'); // Publish language files $this->publishes([__DIR__ . '/../../resources/lang' => base_path('resources/lang/vendor/cart')], 'lang'); // Publish public files and assets. $this->publishes([__DIR__ . '/public/' => public_path('/')], 'public'); } }