Use value="{ { (old('firstname')) ? old('firstname') : '' } }" (obviously no spaces between { { and } }, but render problem on the forum)
Because or expects a variable and not a function.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hey all,
Im trying to find a clean and easy way for displaying the old input when i edit a form. If there is no input old i want to show the stored field data form the database.
The way i want it to work is like this:
old('firstname') or $user->customer->firstname
However this is showing me the integer 1 as value.
I know i can use the old if else shortcode like this ? : however if prefer using the convenient short-cut of blade.
Thanks in advance for helping!
@kazehaya yes, and I told you the reason why it does not work is the blade's or directive expect a variable and you pass a function.
I completely forgot : I think you can use old('firstname', $user->customer->firstname). The second parameter is the default value.
Please or to participate in this conversation.