Inside a partial for creating and editing form I had this to decide whether to display the current value (when editing) or an old value (when editing or creating and not passing the validator)
<input type="text" name="title" value="{{ old('title')?old('title'):$model->title }}">
This became a pain, so I created a custom blade function in app/helpers.php
function decide($inputName, $model){
return old($inputName)?old($inputName):$model->$inputName;
}
This works well however, what I want to achieve is ultimately this
<input type="text" name="title" value="{{ decide('title') }}">
Without the need to pass in $model