loadViewsFrom(__DIR__ . '/../../resources/views', 'sale'); // Load translation $this->loadTranslationsFrom(__DIR__ . '/../../resources/lang', 'sale'); // 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->registerSale(); $this->registerFacade(); $this->registerBindings(); //$this->registerCommands(); } /** * Register the application bindings. * * @return void */ protected function registerSale() { $this->app->bind('sale', function($app) { return new Sale($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('Sale', 'Lavalite\Sale\Facades\Sale'); }); } /** * Register bindings for the provider. * * @return void */ public function registerBindings() { // Bind facade $this->app->bind('tadascript.sale', function ($app) { return $this->app->make('Tadascript\Sale\Sale'); }); // Bind Warehouse to repository $this->app->bind( 'Tadascript\Sale\Interfaces\WarehouseRepositoryInterface', \Tadascript\Sale\Repositories\Eloquent\WarehouseRepository::class ); // Bind Status to repository $this->app->bind( 'Tadascript\Sale\Interfaces\StatusRepositoryInterface', \Tadascript\Sale\Repositories\Eloquent\StatusRepository::class ); // Bind Quote to repository $this->app->bind( 'Tadascript\Sale\Interfaces\QuoteRepositoryInterface', \Tadascript\Sale\Repositories\Eloquent\QuoteRepository::class ); // Bind QuoteItem to repository $this->app->bind( 'Tadascript\Sale\Interfaces\QuoteItemRepositoryInterface', \Tadascript\Sale\Repositories\Eloquent\QuoteItemRepository::class ); // Bind Order to repository $this->app->bind( 'Tadascript\Sale\Interfaces\OrderRepositoryInterface', \Tadascript\Sale\Repositories\Eloquent\OrderRepository::class ); // Bind OrderItem to repository $this->app->bind( 'Tadascript\Sale\Interfaces\OrderItemRepositoryInterface', \Tadascript\Sale\Repositories\Eloquent\OrderItemRepository::class ); // Bind Transaction to repository $this->app->bind( 'Tadascript\Sale\Interfaces\TransactionRepositoryInterface', \Tadascript\Sale\Repositories\Eloquent\TransactionRepository::class ); $this->app->register(\Tadascript\Sale\Providers\AuthServiceProvider::class); $this->app->register(\Tadascript\Sale\Providers\RouteServiceProvider::class); } /** * Merges user's and sale's configs. * * @return void */ protected function mergeConfig() { $this->mergeConfigFrom( __DIR__ . '/../../config/sale.php', 'sale' ); } /** * Register scaffolding command */ protected function registerCommands() { if ($this->app->runningInConsole()) { $this->commands([ Commands\MakeSale::class, ]); } } /** * Get the services provided by the provider. * * @return array */ public function provides() { return ['tadascript.sale']; } /** * Publish resources. * * @return void */ private function publishResources() { // Publish configuration file $this->publishes([__DIR__ . '/../../config/config.php' => config_path('tadascript/sale.php')], 'config'); // Publish admin view $this->publishes([__DIR__ . '/../../resources/views' => base_path('resources/views/vendor/sale')], 'view'); // Publish language files $this->publishes([__DIR__ . '/../../resources/lang' => base_path('resources/lang/vendor/sale')], 'lang'); // Publish public files and assets. $this->publishes([__DIR__ . '/public/' => public_path('/')], 'public'); } }