title: How to access cookie from view in PHP Laravel 5
body: <p>I can access cookie in controller then pass it to view</p>
  
  <pre><code>//HomeController.php
  public function index(Request $request)
  {
    $name = Cookie::get('name');
    return view('index', ['name'=&gt; $name]);
  }
  </code></pre>
  
  <p>But I want to write a small control (widget) that can fetch data from cookie without concern of parent controller. For example, <em>header, footer widgets</em> could fetch its own data without <em>main page controller</em> knowing which data is needed.</p>
  
  <p>I can query the data from database by using View Composer. But, how can I access data from view in the request cookie ?</p>