Show old value while editing the form in Laravel

I want to show the old value in input field of html form in case if validation is fails while editing the form in Laravel. Display the old value in case if I have edited the form data before submit else display the data from database table.

Answers 1
  • Display old value with database value while editing the form

    --PATH resources\views\<home>.blade.php
    <input type="text" name="name" value="{{old('name', $data->name)}}"/>
    This code snippet will display the old value which you have passed while editing the form and if you did not pass any value then it will display the data from the database which you get through the controller.
  • Back to code snippet queries related laravel