I have created the form request for data validation,
I have also created the middleware for request modify which add the one key in the \Illuminate\Http\Request object from taking the value from query parameter
I want \Illuminate\Http\Request object data which is modified by the middleware to be attached with form request so I can further user in controller with the $request object
I have written middleware code to the baseformrequest(custom class) and called the method into my formrequest.
middleware code:
public function handle($request, Closure $next)
{
$requested_method = $request->route()->getActionMethod();
$required_with = [];
if($requested_method == 'show'){
if (!is_null($request->get('_with'))) {
$required_with = explode(',', $request->get('_with'));
}
}
$request->with = $request->get('_with');
return $next($request);
}
I expect all the modified request object can be accessible in My form request object, but I can't access in my Laravel controller