dimanche 27 août 2017

Laravel Cookie interferes with Session and Auth

Currently I'm having a simple form and when I post the form I will set some variables but also want to keep this values for a next time so the user don't have to fill in all form input values.

Now what I'm doing is the following:

use Cookie;

public function setCookieAndHandleFormData(){
    // Handle all form data and store in $form_data
    $form_data = setFormData(); // This is handled correctly (just an array of key values)

    Cookie::queue('cookie_data', $form_data, 43200); // set a cookie
    Session::put('session_data', $form_data); // set a session
}

When I'm executing above code I will get a lot of problems in Laravel 5.2

Functions like Auth::user() and Session::get() will stop functioning. Can anyone explain what is happening? And if I'm using the wrong approach here or something else is happening?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire