File: D:/HostingSpaces/SBogers10/komma.pro/app/KommaApp/Shop/KommaShopServiceProvider.php
<?php
namespace App\KommaApp\Shop;
use App\KommaApp\Shop\ArtisanCommands\IndexCatalog;
use App\KommaApp\Shop\ArtisanCommands\IndexSearch;
use App\KommaApp\Shop\ArtisanCommands\MigrationsAndSeeds\RollbackShopMigrations;
use App\KommaApp\Shop\ArtisanCommands\MigrationsAndSeeds\RunShopMigrations;
use App\KommaApp\Shop\ArtisanCommands\MigrationsAndSeeds\SeedShop;
use App\KommaApp\Shop\ArtisanCommands\InstallTranslations;
use App\KommaApp\Shop\ArtisanCommands\Tests\RunTests;
use App\KommaApp\Shop\ArtisanCommands\VatCheck;
use App\KommaApp\Shop\Cart\ShoppingCartItem;
use App\KommaApp\Shop\Cart\ShoppingCartItemInterface;
use App\KommaApp\Shop\Cart\ShoppingCartService;
use App\KommaApp\Shop\Cart\ShoppingCartServiceInterface;
use App\KommaApp\Shop\Catalog\Kms\CatalogService;
use App\KommaApp\Shop\Catalog\Kms\CatalogServiceInterface;
use App\KommaApp\Shop\Categories\Kms\CategoryController;
use App\KommaApp\Shop\Categories\Kms\CategoryService;
use App\KommaApp\Shop\Categories\Kms\CategoryServiceInterface;
use App\KommaApp\Shop\Categories\Models\Category;
use App\KommaApp\Shop\Checkout\CheckoutService;
use App\KommaApp\Shop\Checkout\CheckoutServiceInterface;
use App\KommaApp\Shop\Discounts\Discount;
use App\KommaApp\Shop\Discounts\DiscountController;
use App\KommaApp\Shop\Discounts\DiscountService;
use App\KommaApp\Shop\Discounts\DiscountServiceInterface;
use App\KommaApp\Shop\Orders\Kms\OrderMailService;
use App\KommaApp\Shop\Orders\Kms\OrderMailServiceInterface;
use App\KommaApp\Shop\Orders\Kms\OrderService;
use App\KommaApp\Shop\Orders\Kms\OrderServiceInterface;
use App\KommaApp\Shop\Products\Product\Product;
use App\KommaApp\Shop\Products\Product\ProductController;
use App\KommaApp\Shop\Products\Product\ProductService;
use App\KommaApp\Shop\Products\Product\ProductServiceInterface;
use App\KommaApp\Shop\Products\ProductComposite\ProductComposite;
use App\KommaApp\Shop\Products\ProductComposite\ProductCompositeController;
use App\KommaApp\Shop\Products\ProductComposite\ProductCompositeService;
use App\KommaApp\Shop\Products\ProductComposite\ProductCompositeServiceInterface;
use App\KommaApp\Shop\Products\ProductGroup\ProductGroup;
use App\KommaApp\Shop\Products\ProductGroup\ProductGroupsController;
use App\KommaApp\Shop\Products\ProductGroup\ProductGroupService;
use App\KommaApp\Shop\Products\ProductGroup\ProductGroupServiceInterface;
use App\KommaApp\Shop\Properties\Models\Property;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Database\Eloquent\Factory as EloquentFactory;
class KommaShopServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
parent::boot();
\Route::model('product', Product::class);
\Route::model('productgroup', ProductGroup::class);
\Route::model('productcomposite', ProductComposite::class);
\Route::model('category', Category::class);
\Route::model('discount', Discount::class);
$this->registerEloquentFactoriesFrom(__DIR__.DIRECTORY_SEPARATOR.'Factories');
$this->bootRoutes();
$this->registerCommands();
}
/**
* Register artisan shop commands
*/
public function registerCommands()
{
$this->commands([
//Installation commands
InstallTranslations::class,
//Migrations and seeds
RunShopMigrations::class,
RollbackShopMigrations::class,
SeedShop::class,
//Test commands
RunTests::class,
//Catalog commands
IndexCatalog::class,
//SearchIndex commands
IndexSearch::class,
VatCheck::class,
]);
}
/**
* Register factories for creating fake models for testing etc.
*
* @param string $path
* @return void
*/
protected function registerEloquentFactoriesFrom($path)
{
$this->app->make(EloquentFactory::class)->load($path);
}
/**
* Enables shop routes
*/
public function bootRoutes()
{
Require (__DIR__.DIRECTORY_SEPARATOR.'ShopRoutes.php');
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
//Product related implementations
$this->app->bind(ProductGroupServiceInterface::class, ProductGroupService::class);
$this->app->bind(ProductCompositeServiceInterface::class, ProductCompositeService::class);
$this->app->bind(ProductServiceInterface::class, ProductService::class);
//Shoppingcart related bindings
$this->app->bind(ShoppingCartItemInterface::class, ShoppingCartItem::class);
$this->app->bind(ShoppingCartServiceInterface::class, ShoppingCartService::class);
//Catalog related implementations
$this->app->bind(CatalogServiceInterface::class, CatalogService::class);
//Discount related implementations
$this->app->bind(DiscountServiceInterface::class, DiscountService::class);
//Category related implementations
$this->app->bind(CategoryServiceInterface::class, CategoryService::class);
//Order related implementations
$this->app->bind(OrderServiceInterface::class, OrderService::class);
$this->app->bind(OrderMailServiceInterface::class, OrderMailService::class);
//Checkout related implementations
$this->app->bind(CheckoutServiceInterface::class, CheckoutService::class);
}
}