I have this function in laravel 5.4 but I cant get anything from cookie.
Cookie::queue('currentLang', 'heb', 999999999);
echo $request->cookie('currentLang');
But I am getting some long string and not what I set.
I have this function in laravel 5.4 but I cant get anything from cookie.
Cookie::queue('currentLang', 'heb', 999999999);
echo $request->cookie('currentLang');
But I am getting some long string and not what I set.
use Illuminate\Support\Facades\Cookie;
Cookie::queue('currentLang', 'heb', 999999999);
echo Cookie::get('currentLang');
I also face to the same issue. it returns null so I have done it using Javascript and PHP like
Setting value in cookie using Javascript
function createCookie(name, value, days) {
var expires;
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
expires = "; expires=" + date.toGMTString();
}
else {
expires = "";
}
document.cookie = name + "=" + value + expires + "; path=/";
}
Retriving cookie using PHP
$_COOKIE["popupId"]