loadViewsFrom(__DIR__.'/../../resources/views/checkout', 'checkout'); Blade::anonymousComponentNamespace('checkout::components', 'checkout'); Route::middleware('web')->group(__DIR__.'/../Checkout/routes/checkout.php'); $this->publishes([ __DIR__.'/../../resources/js/checkout' => resource_path('js/checkout'), __DIR__.'/../../resources/css/checkout.css' => resource_path('css/checkout.css'), ], 'core-checkout-assets'); // The drawer is rendered on every page (from the layout) and its body // partial is re-rendered on every cart mutation — both need the current // cart without a controller in the loop. View::composer( ['checkout::drawer', 'checkout::partials.cart-body'], function (ViewInstance $view) { $service = app(CartService::class); $cart = $service->current(); $view->with('cart', $cart); $view->with('lines', $cart ? $service->activeLines($cart) : collect()); }, ); } }