1

Any ideas why the session variable is not set with 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);
        //dd($res);
    return $res;
    }
    catch (RequestException $e){
        var_dump($e->getResponse()->getBody()->getContents());

    }
}

The request is initiated on my constructor.

Thanks for your help.

RidRoid
  • 961
  • 3
  • 16
  • 39
  • Are your sessions working elsewhere? – dotty Jan 10 '16 at 20:27
  • @dotty No.. I even tried a basic `session_start(); $_SESSION['test'] = 'test';` on the same file, and on the class that triggers this function. no session..I dont get it because the same code worked before. – RidRoid Jan 11 '16 at 08:29

1 Answers1

0

Try replacing your session put line from

session()->put('commit',$res);

To

Session::put('commit', $res);
clean_coding
  • 1,156
  • 1
  • 9
  • 14