【发布时间】:2023-03-23 02:48:01
【问题描述】:
我正在制作一个简单的表单,但出现以下错误:
缺少 [Route: posts.update] [URI: posts/{post}] 的必需参数。 (查看:C:\laragon\www\blog\resources\views\post\edit.blade.php)
{!! Form::model($post, ['action' => 'PostController@update', 'post' => $post]) !!}
从表单将参数添加到控制器的正确方法是什么?
【问题讨论】:
-
你用的是哪个版本的 laravel?
-
试试
{!! Form::model($post, ['action' => 'PostController@update', 'id' => $post]) !!}。我认为问题在于您正在传递“post”并且控制器可能有一个参数$id。