Laravel Delete/Forget Cookie not working


How do you a delete cookies in Laravel. This is not working:

public function logout(Request $request) { $this->guard()->logout(); $request->session()->flush(); $request->session()->regenerate(); Cookie::queue(Cookie::forget('cavpad')); Cookie::queue(Cookie::forget('cavuser')); return redirect('/');


This works, but seems the wrong way to do it:

Cookie::queue(Cookie::make('cavpad', '', 0, null, env('APP_DOMAIN'))); Cookie::queue(Cookie::make('cavuser', '', 0, null, env('APP_DOMAIN')));

Why does the first way not work, but the second way does... btw, has nothing to do with the env()... Just added that in there...


You can do this by using the code I provided, it's pretty much the same, but I know that this way of doing it works for me. But if you need to do it inline, this might also work for you:

Cookie::queue( Cookie::forget('cookieName') );

This is how I think it should be done.


Try redirecting like this:

return redirect('/')->withCookie(Cookie::forget('cavpad'))->withCookie(Cookie::forget('cavuser'));


  • Static Publishing in Silverstripe on Large Sites
  • Eclipse 'Project > Clean…' removes my additional Android src folder. How to fix?
  • Representing element as boolean with JAXB?
  • Converting to JPEG given image data and UTI
  • How do you close open files using Swift?
  • Laravel S3 File Upload MimeType Issue
  • Symfony 3 new project error
  • Pattern combining type test and literal
  • staticfiles and STATIC_URL with virrtualenv - django
  • PHP Carbon “month()” method generates wrong DateTime
  • Laravel 5 how to include autoload.php
  • cast stl::vector containing pointers to stl::vector containing constant pointers
  • IIS7 Application Request Routing HTTPS
  • opengl: adding higher resolution mipmaps to a texture
  • something very wrong with SESSIONS
  • Dealing with XElement null value
  • Error “Reflect.defineMetadata” while trying to load a transient web worker
  • How to handle empty space in url when downloading image from web?
  • Spring Integration Bridge with poller not working as expected for JMS
  • Laravel at least one field is required
  • How to Save JSON data to SQL server database in C#?
  • allocating memory to an array of string
  • How to make Twilio api Post request with the help of AFNetworking?
  • Sending cookie value via httpget but not getting the desired response
  • How can I extract results of aggregate queries in slick?
  • Is there a way to do normal logging with EureakLog?
  • PHP buffered output depending on server setting?
  • Debugging ASP.NET on a built-in web server suddenly stops
  • How to redirect a user to a different server and include HTTP basic authentication credentials?
  • Menu Color Fade on Hover with Jquery
  • Symfony2: How to get request parameter
  • 0x202A in filename: Why?
  • InvalidAuthenticityToken between subdomains when logging in with Rails app
  • log4net write single file for each call to log.info
  • Getting error when using KSoap library to consume .NET web services
  • How to get NHibernate ISession to cache entity not retrieved by primary key
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?