Can be used to receive old input data returned by the validate object. In this way, users can know what data they filled in before when verification fails.
For example, when posting to an address and verifying data errors, you have to return to the previous page. For a better user experience, the filled-in information will be saved in the flash session and displayed on the previous page. This way users won’t make mistakes after painstakingly filling in a lot of form data, and then go back and refill it.
Old input data When the user fails to submit the form, laravel will automatically flash the user's input data into a one-time session (this data will be lost as soon as it is refreshed, so it is called one-time data). Then old('input_name') can take out the flash memory data in the session, thereby preventing the user from re-entering.
You can use phpstorm and then command+b to view its source code,
Retrieve an old input item.
*
@param string $key
@param mixed $default
@return mixed
*/
old($key = null, $default = null)
}
In fact, this also points to request
Can be used to receive old input data returned by the validate object. In this way, users can know what data they filled in before when verification fails.
For example, when posting to an address and verifying data errors, you have to return to the previous page. For a better user experience, the filled-in information will be saved in the flash session and displayed on the previous page.
This way users won’t make mistakes after painstakingly filling in a lot of form data, and then go back and refill it.
Old input data
When the user fails to submit the form, laravel will automatically flash the user's input data into a one-time session (this data will be lost as soon as it is refreshed, so it is called one-time data). Then old('input_name') can take out the flash memory data in the session, thereby preventing the user from re-entering.