I am trying to put $request
in the session variable but when I try to get in the controller its showing error Trying to get property 'page' of non-object
.
code below
JavaScript
x
Session::put('request', $request->all());
if ($request->page == null) {
Session::put('key', $request->all());
}
Advertisement
Answer
The error is not from session. the error on this line if ($request->page == null)
.
The $request->page
variable you’re trying to access is not defined.
Try to check empty condition it will check variable is isset or null as well.
JavaScript
if (empty($request->page)) {
}