55 lines
1.1 KiB
PHP
Executable File
55 lines
1.1 KiB
PHP
Executable File
<?php
|
|
|
|
namespace Webkul\Checkout\Providers;
|
|
|
|
use Illuminate\Foundation\AliasLoader;
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Webkul\Checkout\Facades\Cart;
|
|
|
|
class CheckoutServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Bootstrap services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
include __DIR__ . '/../Http/helpers.php';
|
|
|
|
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
|
|
|
|
$this->app->register(EventServiceProvider::class);
|
|
|
|
$this->app->register(ModuleServiceProvider::class);
|
|
}
|
|
|
|
/**
|
|
* Register services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register(): void
|
|
{
|
|
$this->registerFacades();
|
|
}
|
|
|
|
/**
|
|
* Register cart as a singleton.
|
|
*
|
|
* @return void
|
|
*/
|
|
protected function registerFacades(): void
|
|
{
|
|
$loader = AliasLoader::getInstance();
|
|
|
|
$loader->alias('cart', Cart::class);
|
|
|
|
$this->app->singleton('cart', function () {
|
|
return new Cart();
|
|
});
|
|
|
|
$this->app->singleton('cart', \Webkul\Checkout\Cart::class);
|
|
}
|
|
}
|