2018-09-06 06:20:30 +00:00
|
|
|
<?php
|
|
|
|
|
|
2018-09-28 12:54:26 +00:00
|
|
|
namespace Webkul\Checkout\Providers;
|
2018-09-06 06:20:30 +00:00
|
|
|
|
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
2018-09-13 11:06:17 +00:00
|
|
|
use Illuminate\Foundation\AliasLoader;
|
2018-09-28 12:54:26 +00:00
|
|
|
use Webkul\Checkout\Facades\Cart;
|
2020-01-31 04:42:13 +00:00
|
|
|
use Illuminate\Database\Eloquent\Factory as EloquentFactory;
|
2018-09-06 06:20:30 +00:00
|
|
|
|
2018-09-28 13:28:54 +00:00
|
|
|
class CheckoutServiceProvider extends ServiceProvider
|
2018-09-06 06:20:30 +00:00
|
|
|
{
|
2019-07-01 14:33:16 +00:00
|
|
|
public function boot()
|
2018-09-06 06:20:30 +00:00
|
|
|
{
|
2018-09-27 10:01:25 +00:00
|
|
|
include __DIR__ . '/../Http/helpers.php';
|
2018-09-28 13:28:54 +00:00
|
|
|
|
2018-09-10 09:31:34 +00:00
|
|
|
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
|
2019-02-18 07:30:40 +00:00
|
|
|
|
|
|
|
|
$this->app->register(ModuleServiceProvider::class);
|
2019-10-31 11:37:49 +00:00
|
|
|
|
|
|
|
|
$this->app->register(EventServiceProvider::class);
|
2020-01-31 04:42:13 +00:00
|
|
|
|
|
|
|
|
$this->registerEloquentFactoriesFrom(__DIR__ . '/../Database/Factories');
|
2018-09-06 06:20:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Register services.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function register()
|
|
|
|
|
{
|
2018-09-13 11:06:17 +00:00
|
|
|
$this->registerFacades();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Register Bouncer as a singleton.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
protected function registerFacades()
|
|
|
|
|
{
|
2018-09-19 07:00:24 +00:00
|
|
|
//to make the cart facade and bind the
|
|
|
|
|
//alias to the class needed to be called.
|
2018-09-13 11:06:17 +00:00
|
|
|
$loader = AliasLoader::getInstance();
|
2018-09-20 08:33:28 +00:00
|
|
|
|
|
|
|
|
$loader->alias('cart', Cart::class);
|
2018-09-13 11:06:17 +00:00
|
|
|
|
|
|
|
|
$this->app->singleton('cart', function () {
|
2018-09-20 08:33:28 +00:00
|
|
|
return new cart();
|
2018-09-13 11:06:17 +00:00
|
|
|
});
|
2018-09-20 08:33:28 +00:00
|
|
|
|
2018-09-28 12:54:26 +00:00
|
|
|
$this->app->bind('cart', 'Webkul\Checkout\Cart');
|
2018-09-06 06:20:30 +00:00
|
|
|
}
|
2020-01-31 04:42:13 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Register factories.
|
|
|
|
|
*
|
|
|
|
|
* @param string $path
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
protected function registerEloquentFactoriesFrom($path): void
|
|
|
|
|
{
|
|
|
|
|
$this->app->make(EloquentFactory::class)->load($path);
|
|
|
|
|
}
|
2018-09-20 08:33:28 +00:00
|
|
|
}
|