Laravel

Laravel: Usage of old() in form when editing

Best practice to show old value when editing a form in Laravel?
Laravel function old have default parameter if no old data found in session default value will be displayed.

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

Replace expression in template with the default object data.

<input name="title" value="{{old('title', $post->title)}}" />

About the author

Danyal

I'm working as programmer since 2002. Born, grew up, studied and worked in Pakistan now Im located in Denmark since 2006.

View all posts