File: D:/HostingSpaces/SBogers10/conmeq.komma.pro/app/Komma/Shop/KommaShopServiceProvider.php
<?php
namespace App\Komma\Shop;
use App\Komma\Kms\QualityAssurance\ExtraDuskTools;
use App\Komma\Shop\ArtisanCommands\IndexCatalog;
use App\Komma\Shop\ArtisanCommands\IndexSearch;
use App\Komma\Shop\ArtisanCommands\MigrationsAndSeeds\RollbackShopMigrations;
use App\Komma\Shop\ArtisanCommands\MigrationsAndSeeds\RunShopMigrations;
use App\Komma\Shop\ArtisanCommands\MigrationsAndSeeds\SeedShop;
use App\Komma\Shop\ArtisanCommands\InstallTranslations;
use App\Komma\Shop\ArtisanCommands\RunTests;
use App\Komma\Shop\ArtisanCommands\VatCheck;
use App\Komma\Shop\Cart\CartRoutes;
use App\Komma\Shop\Cart\ShoppingCartItem;
use App\Komma\Shop\Cart\ShoppingCartItemInterface;
use App\Komma\Shop\Cart\ShoppingCartService;
use App\Komma\Shop\Cart\ShoppingCartServiceInterface;
use App\Komma\Shop\Catalog\CatalogRoutes;
use App\Komma\Shop\Catalog\Kms\CatalogService;
use App\Komma\Shop\Catalog\Kms\CatalogServiceInterface;
use App\Komma\Shop\Categories\CategoryRoutes;
use App\Komma\Shop\Categories\Kms\CategoryService;
use App\Komma\Shop\Categories\Kms\CategoryServiceInterface;
use App\Komma\Shop\Checkout\CheckoutRoutes;
use App\Komma\Shop\Checkout\CheckoutService;
use App\Komma\Shop\Checkout\CheckoutServiceInterface;
use App\Komma\Shop\Discounts\DiscountRoutes;
use App\Komma\Shop\Discounts\DiscountService;
use App\Komma\Shop\Discounts\DiscountServiceInterface;
use App\Komma\Shop\Orders\Kms\OrderMailService;
use App\Komma\Shop\Orders\Kms\OrderMailServiceInterface;
use App\Komma\Shop\Orders\Kms\OrderService;
use App\Komma\Shop\Orders\Kms\OrderServiceInterface;
use App\Komma\Shop\Orders\OrderRoutes;
use App\Komma\Shop\Payment\PaymentRoutes;
use App\Komma\Shop\Payment\PaymentService;
use App\Komma\Shop\Payment\PaymentServiceInterface;
use App\Komma\Shop\Products\Product\ProductService;
use App\Komma\Shop\Products\Product\ProductServiceInterface;
use App\Komma\Shop\Products\ProductComposite\ProductCompositeService;
use App\Komma\Shop\Products\ProductComposite\ProductCompositeServiceInterface;
use App\Komma\Shop\Products\ProductGroup\ProductGroupService;
use App\Komma\Shop\Products\ProductGroup\ProductGroupServiceInterface;
use App\Komma\Shop\Products\ProductRoutes;
use App\Komma\Shop\Properties\PropertyRoutes;
use App\Komma\Shop\ShipmentGroups\ShipmentGroupRoutes;
use App\Komma\Shop\Shipments\ShipmentRoutes;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Database\Eloquent\Factory as EloquentFactory;
use Illuminate\Support\Facades\Route;
class KommaShopServiceProvider extends ServiceProvider
{
use ExtraDuskTools;
/**
* Bootstrap the application services.
*
* @return void
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/
public function boot()
{
$this->mapWebRoutes();
parent::boot();
if(\App::environment() == 'local' || \App::environment() == 'testing') {
$this->registerEloquentFactoriesFrom(__DIR__ . DIRECTORY_SEPARATOR . 'Factories');
}
$this->registerCommands();
$this->setupExtraDuskTools();
}
/**
* 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,
]);
}
/**
* Define the "web" routes for the shop part of the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected function mapWebRoutes()
{
Route::middleware('web')
->group(function () {
OrderRoutes::web();
ProductRoutes::web();
CatalogRoutes::web();
CartRoutes::web();
CategoryRoutes::web();
CheckoutRoutes::web();
}
);
Route::middleware(['web', 'kms'])
->prefix('kms')
->group(function () {
DiscountRoutes::kms();
PropertyRoutes::kms();
OrderRoutes::kms();
ProductRoutes::kms();
CatalogRoutes::kms();
CategoryRoutes::kms();
ShipmentGroupRoutes::kms();
ShipmentRoutes::kms();
}
);
Route::middleware('pspapi')
->group(function() {
PaymentRoutes::web();
}
);
}
/**
* Register factories for creating fake models for testing etc.
*
* @param string $path
* @return void
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/
protected function registerEloquentFactoriesFrom($path)
{
$this->app->make(EloquentFactory::class)->load($path);
}
/**
* 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);
//Transaction / payment related implementations
$this->app->bind(PaymentServiceInterface::class, PaymentService::class);
}
}