For example; Data is coming from Angular app as _transaction_id because of getter/setter in typescript hence I need a middleware to remove the initial underscore in all request keys
Yeah, you can do that too, just change the cleanData function of your middleware
/**
* Check the parameters and remove the initial underscore
*
* @param array $data
* @return array
*/privatefunctioncleanData(array$data){returncollect($data)->mapWithKeys(function($value,$key){if($key!=='_token'){$key=preg_replace("/(^_)/",'',$key);}return[$key=>$value];})->all();}
What am doing here is to remove the initial underscore if the request key is not '_token', since laravel needs that for csrf (in case you are using the web route group). Sorry for the late response. Let me know if it helps.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
How about I want to transform the request key
For example; Data is coming from Angular app as _transaction_id because of getter/setter in typescript hence I need a middleware to remove the initial underscore in all request keys
Yeah, you can do that too, just change the cleanData function of your middleware
What am doing here is to remove the initial underscore if the request key is not '_token', since laravel needs that for csrf (in case you are using the web route group). Sorry for the late response. Let me know if it helps.