Level 73
Just use:
$request->except(['password']);
And here the documentation on how to retrieve input from the request.
2 likes
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
How can I remove $request['password'] from $request->all() ?
Thanks
The line that I gave you does not deletes the password, but gets all the data except the password from the Request.. so you just need this:
$result = User::create($request->except(['password']));
OR in your if statement, compare if the password is empty.. you are setting it's value to be empty.
if($request['password'] = '')
Should be this
if($request['password'] === '')
AND $request->except does not deletes the password from the array, it just excludes that one from the RESULT.
Please or to participate in this conversation.