我是新来laravel。使用5.4版本,试图搜索,但没有看到我做错了什么。在我看来,我不断收到“未定义的变量:帖子”。我也在做表单模型绑定。手动输入URL时,模型绑定可以正常工作。只是不能点击链接来调出编辑视图。Laravel undefine变量的视图
我的路线:
Route::get('test/{id}/edit','[email protected]');
我的控制器:
public function edit($id)
{
$post = Post::find($id);
if(!$post)
abort(404);
return view('test/edit')->with('test', $post);
}
我的形式:
{{ Form::model($post, array('route' => array('test.update', $post->id), 'files' => true, 'method' => 'PUT')) }}
您正在返回的'$ POST'内容为''test'' - 所以,你可以在你的看法与'$ test'代替'$ POST'访问该变量在这种情况下。 – CodeBrauer