Skip to content

Instantly share code, notes, and snippets.

@breda
Created May 28, 2016 11:48
Show Gist options
  • Save breda/f9d7c83311daf6b922f94823c3e3cf06 to your computer and use it in GitHub Desktop.
Save breda/f9d7c83311daf6b922f94823c3e3cf06 to your computer and use it in GitHub Desktop.
<?php
use Illuminate\Http\Request;
use Illuminate\Cookie\CookieJar;
class CookieManager {
/*
* Get Cookie by name.
*/
public function get($name, Request $request)
{
return $request->cookie($name);
}
/*
* Queue a cookie to be sent in the next response.
*/
public function put(string $name, string $value, int $minutes, string $path = null, string $domain = null, bool $secure = false, bool $httpOnly = true, CookieJar $cookies)
{
$cookies->queue($name, $value, $minutes, $path, $domain, $secure, $httpOnly);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment