mardi 17 mars 2020

How to set cookie in custom command and get it in middleware Laravel

I am looking for way to set cookie in console custom command and get it in middleware in Laravel. This is what I am trying

In custom command,

Cookie::queue('login', 'true', 1);
$cookies = array('login' => true);

In middleware,

Cookie::get('login') // unable to get here set cookie

Calling route internally through custom command

$req = Request::create('/my/url', 'POST', $params, $cookies);
$res = app()->handle($req);
$responseBody = $res->getContent();

Reference symfony/http-foundation calling-routes-internally

Your assistance would be highly appreciated.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2UhK4LE
via IFTTT

Aucun commentaire:

Enregistrer un commentaire