I'm having problems to create cookie in Laravel5. The code is below.
$input = $request->input('first');
if($request->hasCookie('first'))
{
return response()->json('ok');
}
else
{
Cookie::make('first', 'first', 1);
return response()->json('no');
}
I also tried this:
public function createCookie(CookieJar $cookieJar)
{
$cookieJar->make('first', 'first', 1);
}
Nothing works for me, can someone illuminate me? Thanks in advance. When i try to var_dump and get the cookie value it gives me NULL.