Call to a member function session() on null
public function success() {
$paid = $this->request->session()->get('paid');
if ($paid['paid'] == true ) {
return redirect('payments/confirmed');
}
.....
}
The below when called is returning:
"Call to a member function session() on null"
Do sessions always need to be set or not Null for you to reference them? And if so, is there a work around?
You can access session data like
if($request->session()->get('paid.paid')) {
return redirect('payments/confirmed');
}
docs here
https://laravel.com/docs/5.7/session#retrieving-data
if the value is not set, you will get null back.
dd($request->session()->get('cats')); //null
Please or to participate in this conversation.