php - Laravel cookie::forget doesn't work? -


i have code:

cookie::forget('vendor'); return redirect::route('vendor_login'); 

what supposed do, remove vendor cookie , redirect login page. however, doesn't delete cookie. understanding, expect send setcookie header vendor value of null , negative time. doesn't send setcookie header @ all. why this?

this works perfectly:

cookie::queue('paddle_vendor', null, -1); return redirect::route('vendor_login'); 

you can use queue method this:

cookie::queue(cookie::forget('vendor')); return redirect::route('vendor_login'); 

which in way allows delete multiple cookies @ once too. more information checkout answer here: https://stackoverflow.com/a/33724308/247670

or antonio said:

$cookie = cookie::forget('vendor'); return redirect::route('vendor_login')->withcookie($cookie); 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -