Reputation: 2185
How to make valid condition for value tag in laravel 5.7 if field was modified and we have to show new value if field was modified ? I tried like that with required condition :
(old('common_settings_site_name') ? old('common_settings_site_name') : ( isset($common_settings_site_name) ?$common_settings_site_name : '' ) ),
it is good, bur not n case when field with existing value was cleared, then original value(not old - clear) is shown.
Like text field had some text “Value” The field was cleared. submitting form original field would be shown not empty string as I exepected ? How to fix it ?
Thanks!
Upvotes: 1
Views: 103
Reputation: 3095
Look at definition of old :
/**
* Retrieve an old input item.
*
* @param string $key
* @param mixed $default
* @return mixed
*/
function old($key = null, $default = null)
{
return app('request')->old($key, $default);
}
You can use 2nd parameter for old method with your var.
Upvotes: 1