Answer the question
In order to leave comments, you need to log in
How to write old, value from the model, or empty value to the input?
There is an input with value="{{ old('name') }}"
located on the /test page, if there is an error in value, the old value will be. It is necessary to make sure that when opening / test / 2, information from the model is already written there. And you need to use one template.
You can, of course, shove this field into yield and, depending on /test or /test/2, change it using @section, but maybe there is an easier way?
Structure:
test.blade.php with @extends('index')
test2.blade.php with @extends('index')
index.blade.php with the form itself.
It would be desirable that the form for creation and editing was the same. Now I change everything through yield.
It roughly looks like this:
try{
echo old(name', $input->name); //$input->name не существует, пока не передали из контроллера
} catch() {
echo old(name');
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question