Hello,
Here my case.
I need to filter data send to $request->get('filters') and delete invalid subdata before making a replace.
So, I'm doing something like this:
$arrFilters = $request->get('filters');
foreach ($arrFilters as $fieldName => $arrValue) { $fieldValidator = Validator::make( ['field' => $fieldName], AdvertConfigField::$validationRules['search'] );
if ($fieldValidator->fails()) { unset($arrFilters[$fieldName]); } }
$request->replace(['filters' => $arrFilters]);
Then, if I make a dd() of $request->all() or a dd() of $request-input('filters'), I received the correct filtered information.
But, if I make a $request->get('filters'), I always received the non-filtered data.
How is it possible?
Thx, Olivier
Laravel Request class does not have 'get' method. It inherits it form Symfony Request class. All modifications happens on Laravels ParameterBag, so when dumping all or input you get modified result. Get method just gets raw data again.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community