Chore: Extracting Wishlist from 3dealer to Core
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Core\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\Core\Auth\Events\UserAuthenticated;
|
||||
use Modules\Core\Wishlist\Listeners\MergeGuestWishlistOnLogin;
|
||||
use Modules\Core\Wishlist\Services\WishlistService;
|
||||
|
||||
class WishlistServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function register(): void
|
||||
{
|
||||
// One instance per request: it caches the guest cookie's ids, so a
|
||||
// toggle and a later has() in the same request agree.
|
||||
$this->app->scoped(WishlistService::class);
|
||||
}
|
||||
|
||||
public function boot(): void
|
||||
{
|
||||
$this->loadRoutesFrom(__DIR__.'/../Wishlist/routes/web.php');
|
||||
|
||||
Event::listen(UserAuthenticated::class, MergeGuestWishlistOnLogin::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user