lundi 28 décembre 2015

Retrieve system cookies in Laravel

In my old php code, I can get a cookie using

<?php echo json_encode($_COOKIE['basket']); ?>;

Now how can I do this in laravel.

All I want to do is something like this in my controller;

public function author ($) {
    // Get system cookie
    $cookie = retrieve a cookie
    return view('pages.blog.author', ['cookie' => $cookie]);
}

Then I can access it in my view.

FYI; the cookie I want to retrieve was not sent with the request. This is cookie that has been sent by visiting another page.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire