I am using the latest version of Laravel 4 and I cannot set cookies:
Route::get('cookietest', function()
{
Cookie::forever('forever', 'Success');
$forever = Cookie::get('forever');
Cookie::make('temporary', 'Victory', 5);
$temporary = Cookie::get('temporary');
return View::make('cookietest', array('forever' => $forever, 'temporary' => $temporary, 'variableTest' => 'works'));
});
Show script:
@extends('layouts.master')
@section('content')
Forever cookie: {{ $forever }} <br />
Temporary cookie: {{ $temporary }} <br />
Variable test: {{ $variableTest }}
@stop
Productivity:
Forever cookie:
Temporary cookie:
Variable test: works
It doesn’t matter if I refresh the page or create cookies in one route and try to access them in another. I can confirm that no cookies are set with the above operation. The cookies "laravel_payload" and "laravel_session", as well as "remember_ [HASH]" exist, and I can set cookies using regular PHP using setcookie.
No errors or errors were found in any place that I can find. I am running Linux Mint locally and Debian on my server, with both nginx and the same problem in both places.
source
share