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

前端 未结 6 1063
暗喜
暗喜 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:50

    Function old have default parameter if no old data found in session.

    function old($key = null, $default = null)
    

    You can replace expression in template with

    value="{{old('title', $dog->title)}}"
    

提交回复
热议问题