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:
Another way to do that is get the data from the dog
class, like this:
value="{{old('title') ?? $dog->title }}"
Why? Because old()
is for validation; when you fail validation, the input will remain available in the field. In the case where validation hasn't fired yet, value
will be filled with $dog->title
.