How to easily change the value of a request parameter in Laravel.
You can do this by using the merge method to merge an array or collection with the original.
This works by overwriting the value of the key if there is a match.
In the example below, $request->password will become encrypted.
$request->merge([
'password' => Crypt::encryptString($request->password),
]); As the password key on the $request array will be overwritten.
If the key doesn’t exist, the key and value will just be added in rather than overwritten.
A drained and empty Kennington reservoir images from a drone in early July 2024. The…
Merrimu Reservoir from drone. Click images to view larger.
Using FTP and PHP to get an array of file details such as size and…
Creating and using Laravel form requests to create cleaner code, separation and reusability for your…
Improving the default Laravel login and register views in such a simple manner but making…
Laravel validation for checking if a field value exists in the database. The validation rule…