FleetCart/Modules/Cart/Providers/CartServiceProvider.php

30 lines
660 B
PHP
Raw Normal View History

2023-06-11 12:14:03 +00:00
<?php
namespace Modules\Cart\Providers;
use Modules\Cart\Cart;
use Illuminate\Support\ServiceProvider;
class CartServiceProvider extends ServiceProvider
{
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->singleton(Cart::class, function ($app) {
return new Cart(
$app['session'],
$app['events'],
'cart',
session()->getId(),
config('fleetcart.modules.cart.config')
);
});
$this->app->alias(Cart::class, 'cart');
}
}