I'm making a simple form and I'm getting the following error:

Missing required parameters for [Route: posts.update] [URI: posts/{post}]. (View: C:\laragon\www\blog\resources\views\post\edit.blade.php)

{!! Form::model($post, ['action' => '[email protected]', 'post' => $post]) !!}

What's the right way to add the parameter to the controller from the form?

1 Answers

Diego Cespedes On Best Solutions

Try like this:

{!! Form::model($post, ['action' => ['[email protected]', $post->id], 'method' => 'PUT']) !!}

If your route is a resource:

Route resource


Form update

{!! Form::model($post, ['route' => ['post.update', $post->id], 'method' => 'PUT']) !!}