skip to Main Content

How to pass a parameter to a middleware? – Laravel

I have this route in my routes/web.php: Route::get('/checkout', [CheckoutController::class, 'index'])->name('checkoutIndex')->middleware('auth'); My CheckoutController: function index() { if (Cart::instance('default')->count() == 0) { return redirect()->route('cartIndex', App::getLocale())->withErrors('Your shopping cart is empty! Please select an item to checkout.'); } $discount = session()->has('coupon') ? session()->get('coupon')['discount'] :…

VIEW QUESTION
Back To Top
Search