Hello Everyone I am new to the laravel and working with laravel is quite fun... I have a query. instead of writind in words i would like to write the code as follows:-
Route::get('cookie_create',function(){ $cookie = Cookie::make('fname','varun',30); return Redirect::to('http://www.yahoo.com')->withCookie($cookie); });
Route::get('cookie_get',function(){ $cookie = Cookie::get('fname','no cookie'); return $cookie; });
Route::get('cookie_delete',function(){ Cookie::forget('fname'); return 'cookie has bee deleted'; });
Now when i am accessing the cookie_delete path the cookies are not deleting... It is not showing the default value.Please let me know where i am wrong..
You need to return Response
Route::get('cookie_delete',function(){
$cookie = Cookie::forget('fname');
return Response::make('cookie has bee deleted')->withCookie($cookie);
});
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community