I have a middleware in my project that call in every request. It will check if Request has a specific cookie, then delete another cookie. But it seems Cookies are not forgotten or set in Laravel until return in the response. something like return response('view')->withCookie($cookie);
that is not possible in middlewares.
Also I tried Cookie::queue(Cookie::forget('myCookie'));
nothing happened and cookie is shown in my browser.
This is my middleware handle method:
public function handle(Request $request, Closure $next)
{
if (! $request->cookie('clear_token')) {
cookie()->forget('access_token'); # not worked
Cookie::queue(Cookie::forget('access_token')); # not worked
}
return $next($request);
}
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3fNObbN
via IFTTT
Aucun commentaire:
Enregistrer un commentaire