I am writing the logic for an edit form and have some complications when displaying data in the inputs.
When I initially show the form, I show the records values like:
value="{{$dog->title}}"
Then when the form does not pass the validation I need to show the old input, so that user does not loose what he has already input. So I need to have a way to display old data like:
value="{{old('title')}}"
Because I need to input old data in case it exists, I ended up with this code:
value="{{$dog->title or old('title')}}"
And in controller I check if Request has old input, I assign the $dog var a null value.
I wanted to ask if that is considered an OK practice or is there a better and 'correct' way to do it?
old('manager_id', $department->manager->id ?? '')
– Semiology