FleetCart/Modules/Cart/Providers/CartServiceProvider.php
2023-12-03 14:07:47 +00:00

31 lines
696 B
PHP

<?php
namespace Modules\Cart\Providers;
use Modules\Cart\Cart;
use Modules\Cart\Storages\Database;
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(
new Database(),
$app['events'],
'cart',
session()->getId(),
config('fleetcart.modules.cart.config')
);
});
$this->app->alias(Cart::class, 'cart');
}
}