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

Turn on CSRF protection for a group of GET routes in Laravel

I have the following group of GET routes on Laravel: Route::get('/location/get', 'Ajax@getProducts'); Route::get('/products/get', 'Ajax@getProducts'); Route::get('/schedule/get', 'Ajax@getProducts'); I want to protect those routes with the automatically generated CSRF token from Laravel. I have read some workarounds about overriding method: VerifyCsrfToken@isReading(...), but…

VIEW QUESTION

searchig in kibana Discover by KQL syntax – Laravel

I have created a middleware in laravel! like below <?php namespace AppHttpMiddleware; use CarbonCarbon; use Closure; use IlluminateHttpRedirectResponse; use IlluminateHttpRequest; use IlluminateHttpResponse; use IlluminateSupportFacadesLog; use phpDocumentorReflectionTypesString_; class SystemActivityLogger { /** * Handle an incoming request. * * @param IlluminateHttpRequest $request…

VIEW QUESTION
Back To Top
Search