Reputation: 613
I am trying to check a condition based on cookie but I am not able to do that.
public function add_to_fav($product_id){
$user_id = Cookie::has('u_id');
if($user_id === 1){
return "$is_already_added";
} else{
return "Login First";
}
}
Upvotes: 1
Views: 672
Reputation: 36
I just use the isset($_COOKIE['u_id'])
and it works. Hope it worked for you :)
Upvotes: 2