0

Unable to store cookie with the following code in Laravel 5.4

$row = cookie('name', 'value', 52400);

This one is also not working

Cookie::queue(Cookie::make('name', 'value', 'minutes'));

Can you please have a look into this,what can be the issue ?

1
  • Are you actually providing values to Cookie::queue(Cookie::make('name', 'value', 'minutes'));? Like Cookie::queue(Cookie::make('myCookie', true, 60));? Commented Aug 23, 2017 at 15:51

1 Answer 1

1

Try attach the cookie() method to a respomse():

return response()->view('file_name')->cookie('name', 'value', $minutes);

Here are some examples: http://coursesweb.net/laravel/cookies

  • For Cookie queuing you have to add this line in controller to use Cookie facades:

    use Cookie;

Then use:

Cookie::queue('name', 'value', $minutes);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.