What is the best practice to show old value when editing a form in Laravel?

前端 未结 6 1072
暗喜
暗喜 2021-02-01 03:04

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:

6条回答
  •  天涯浪人
    2021-02-01 03:27

    There is nothing wrong with the way you are doing things as Laravel gives multiple ways to handle the situation you're describing.

    What I would suggest is using the Laravel Collective Form and HTML packages to build your form. This package will automatically handle binding old request values to your form if validation fails

    https://laravelcollective.com/docs/5.2/html

提交回复
热议问题