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

Laravel 9 pass variable from route to controller

My problem: I am currently trying to refactor some of my controllers. Doing so I found these two routes: Route::get('/events', [EventsController::class, 'eventsList'])->name('event-list'); Route::get('/courses', [EventsController::class, 'allCoursesList'])->name('all-events'); they show different filter options in the frontend. What I want to do: Example Code:…

VIEW QUESTION
Back To Top
Search