I am trying to drop a cookie for a specific view, so that a user can only visit that page once. However, what I have now is not redirecting the user away from the view on repeated viewings like I want. Here is what I have:
public function getWelcome() {
// Drop cookies and check for it...
$cookie = Cookie::get('cs_welcome');
if(isset($cookie) && $cookie == 1) {
return Redirect::to('/fans/'.Auth::user()->url_tag);
}
else {
$cookie = Cookie::forever('cs_welcome', 1);
}
return View::make('fans.welcome');
Basically I want them to only see the fans.welcome view once. If it is a repeated visit, I want them to go to /fans/Auth::user()->url_tag. Is there something I'm missing here? Thank you for your help.