mercredi 31 août 2016

How to populate edit form fields in laravel 5.3

I have a problem in populating edit form fields in my first Laravel 5.3 application. In examples I have found online, they have used Form facade to do it. However, I prefer to use plain html.

This is my controller action

public function edit()
{
    $profile = Profile::find(Auth::user()->id);
    return  view('profile.edit', ['profile' => $profile]);
}

In my view file I have a form like this

<form method="POST" action="">

<input id="name" type="text" name="name" value="">
...
</form>

Problem is, above input field is not populated with the value of the $profile->name.

I can get it to work, setting the value attribute like



Since I'm new to Laravel framework I want to know if there is a better way to do that.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire