File: D:/HostingSpaces/SBogers10/blije-gasten.komma.pro/app/Komma/Shop/KommaShopServiceProvider.php
<?php
namespace App\Komma\Shop;
use App\Komma\Globalization\RegionInfo;
use App\Komma\Globalization\RegionInfoInterface;
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\Categories\CategoryRoutes;
use App\Komma\Shop\Checkout\CheckoutRoutes;
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\ProductRoutes;
use App\Komma\Shop\Properties\PropertyRoutes;
use App\Komma\Shop\Search\SearchRoutes;
use App\Komma\Shop\ShipmentGroups\ShipmentGroupRoutes;
use App\Komma\Shop\Shipments\ShipmentRoutes;
use App\Komma\Shop\ShippingCosts\ShippingCostRoutes;
use App\Komma\Shop\Vat\VatRoutes;
use App\Komma\Shop\Vat\VatService;
use App\Komma\Shop\Vat\VatServiceInterface;
use App\Komma\Zipcodes\ZipcodeRoutes;
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();
}
/**
* 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,
//Search 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 () {
CartRoutes::web();
CheckoutRoutes::web();
ProductRoutes::web();
SearchRoutes::web();
CategoryRoutes::web();
ZipcodeRoutes::web();
PaymentRoutes::web();
// OrderRoutes::web();
});
Route::middleware(['web', 'kms'])
->prefix('kms')
->group(function () {
Route::group(['middleware' => 'auth:kms'], function () {
// DiscountRoutes::kms();
// PropertyRoutes::kms();
OrderRoutes::kms();
ProductRoutes::kms();
// CatalogRoutes::kms();
CategoryRoutes::kms();
// ShipmentGroupRoutes::kms();
// ShipmentRoutes::kms();
// ShippingCostRoutes::kms();
VatRoutes::kms();
ZipcodeRoutes::kms();
});
});
Route::middleware('pspapi')
->group(function () {
PaymentRoutes::pspapi();
});
}
/**
* 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(ShoppingCartItemInterface::class, ShoppingCartItem::class);
$this->app->bind(ShoppingCartServiceInterface::class, ShoppingCartService::class);
$this->app->bind(DiscountServiceInterface::class, DiscountService::class);
// $this->app->bind(OrderServiceInterface::class, OrderService::class);
$this->app->bind(OrderMailServiceInterface::class, OrderMailService::class);
// $this->app->bind(CheckoutServiceInterface::class, CheckoutService::class);
$this->app->bind(PaymentServiceInterface::class, PaymentService::class);
$this->app->bind(VatServiceInterface::class, VatService::class);
//Bind globalisation classes
$this->app->bind(RegionInfoInterface::class, function () {
$regionInfo = RegionInfo::getInstance(config('shop.culture'));
return $regionInfo;
});
}
}