florent6001
4 months ago
177
2
Laravel

@if(Cookie::has('cookie_name') return false even if cookie exist

Posted 4 months ago by florent6001

Hi all,

I have this code :

@if(Cookie::has('accept_cookie'))
    Cookie exist
@else
    Cookie doesn't  exist
@endif

It always show Cookie doesn't exist, even if the cookie exist. What is wrong with this please ? My controller only show the view, doesn't pass parameters to the view :

public function index()
{
    return view('pages/homepage');
}

Thank's for your help

Please sign in or create an account to participate in this conversation.