user16993770
user16993770

Reputation:

cookie laravel s

Let's say I have a like field in my model, now I want to make the functionality of adding a like using Cookie. For example, we have an article ID, we check in cookies, if there is no data, then we add like and set the time for 10 hours, for example, and so on, 10 hours pass, we check and again we can add like and set this time again. If the data is already there, then we do not add like and do not update the time.

Can anyone see some examples of this? Or where to start and how to implement it?

I read the documentation but did not quite understand how it should work

Let's get a value with a like field

$likes = Request::cookie('like');

Choosing the time

$minutes = 600;

And what's next, how can I make a check to add a like?

Upvotes: 1

Views: 101

Answers (1)

Benjamin
Benjamin

Reputation: 21

Use Replace function on the string and replace " )." with ")."

Upvotes: 2

Related Questions