How to work with cookies in Laravel 5.2
<p>I'm setting cookie on some click event. Then after storing value in cookie, I want to </p>

<ol>
<li>Check for existence of cookie</li>
<li>Get cookie values</li>
</ol>

<p>I have developed a function by referring Laravel official docs. Console shows that cookies have been set. But after that, I can not solve two point (mentioned in above list) for view(Blade Template). It always shows <code>(Cookie::get('cookie.clients'))</code> 'null'. But browser console displays that cookie
.
If anyone knows answer, it will be appreciated. </p>

<p>Here is my code.</p>

<p><strong>Controller</strong></p>

<pre><code>use App\Client;
use App\Http\Requests;
use Illuminate\Http\Request;
use Validator;
use App\Http\Controllers\Controller;
use App\Repositories\ClientRepository;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cookie;

class ClientController extends Controller
{
    public function cookieadd(Request $request, Client $client)
    {
        $clients = [];
        if (Cookie::get('cookie.clients') != null)
        {
            $clients = Cookie::get('cookie.clients');
        }
        array_push($clients, $client);

        Cookie::forever('cookie.clients', $clients);

        return redirect('/client');
    }
}
</code></pre>

<p><strong>View</strong></p>

<pre><code>@if (Cookie::get('cookie.clients') != null)
&lt;p&gt;cookie is set&lt;/p&gt;
@else
&lt;p&gt;cookie isn't set&lt;/p&gt;
@endif
</code></pre>