Summer Sale! All accounts are 50% off this week.

RidouaneHicham's avatar

L5 session put not working

hi,

I dont get why I cant create a session variable using this code :

public function commitTransaction($cluster,$transId)
{
    try {
        $response = $this->client->request('PUT', 'https://' . $cluster . '/' . $transId, [
            'auth' => ['id', 'pass'],
            'proxy' => '',
            'verify' => false,
            'json' => [
                'state' => 'VALIDATING'
            ]
        ]);
    $res = $response->getBody()->getContents();
    session()->put('commit',$res);
    }
    catch (RequestException $e){
        var_dump($e->getResponse()->getBody()->getContents());

    }
 }

Thanks for your help.

0 likes
4 replies
ahuggins's avatar

are you using Laravel 5.2? Does your route include the 'web' middleware group? If not the sessions may not be available

Please or to participate in this conversation.