I want to create a nested parameter grouping in my query where the value of one of my nested where
is gotten from the form.
if($request->view != '') {
$query->where(function ($query) {
$query->where('type', $request->view)
->orWhere('type', 2);
})->get();
}
Right now I'm getting Undefined variable: request
.
How do I get the value of $request->view
in the function?