Support the ongoing development of →
Requests Session Views
Last updated 2 years ago.

In your controller:

        $value = $request->cookie('test-cookie');

        if ($value == 'test') {
            return view('view-with-no-form');

        $view = view('view-with-form');

        $response = new Response($view);

        $response->withCookie('test-cookie', 'test', 60);

        return $response;

Hi @ssomenzi.

I'm not quite sure how this will work according to what I say above.

  1. Submitting a form via AJAX
  2. In the method that handles the AJAX request, I set a cookie valid for an hour.
  3. On a complete different method/route I need to retrieve the value of the previous cookie

Hope this make sense


Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.