Laravel using Cookies to Save URL Question Mark Parameter

In Laravel most of the time cookies are set by the response .Further most of the posts does not directly tell how to retire URL Get  parameters.


Eg: https://www.blogger.com/?blogID=1441573773987640178

To retrieve the value we can take the value in routes >>web.php

Route::get('/', function(){

     $term = Input::get('blogID');
      if(isset($term)){
        Cookie::queue(Cookie::make('
blogID',$term, 60*24*365));
      }
    return view('home');
});

In here cookies are save using (Cookie::make) . In the next response the cookie value get saved in client browser.
              e.g. $cookie = Cookie::make($name, $value, 60);
http://laravel-recipes.com/recipes/48/creating-a-new-cookie

To retrieve the Cookies value is simple

      $request->cookie('blogID');


Comments

Popular posts from this blog

ENOENT: no such file or directory, rename : node_modules/async

react-quill Integrate quill-image-resize-module