Cookies: Attaching Cookies To Responses

Return response('Hello World')->cookie(
    'name', 'value', $minutes
);
Return response('Hello World')->cookie(
    'name', 'value', $minutes, $path, $domain, $secure, $httpOnly
);
Cookie::queue(Cookie::make('name', 'value', $minutes));

Cookie::queue('name', 'value', $minutes);
Return response($content)
                ->header('Content-Type', $type)
                ->cookie('name', 'value', $minutes);
->cookie($name, $value, $minutes, $path, $domain, $secure, $httpOnly)
Cookie::queue(Cookie::make('name', 'value', $minutes));

Cookie::queue('name', 'value', $minutes);
  • You may attach a cookie to an outgoing Illuminate\Http\Response instance using the cookie method. .
  • Alternatively, you can use the Cookie facade to "queue" cookies for attachment to the outgoing response from your application.
  • You may use the cookie method to generate a cookie and fluently attach it to the response instance.
  • Alternatively, you can use the Cookie facade to "queue" cookies for attachment to the outgoing response from your application.

Related concepts

Attaching Cookies To Responses

Cookies: Attaching Cookies To Responses — Structure map

Clickable & Draggable!

Cookies: Attaching Cookies To Responses — Related pages: