laravel 如何将变量传递到刀片路由中

4xrmg8kj  于 2023-04-07  发布在  其他
关注(0)|答案(1)|浏览(125)

我正在使用Route::资源作为我的项目路由。在我看来,我希望将project-〉id传递到project.update路由中。
这是我想做的:

{{route('project.update',$project->id)}}

我也试过:

{{route('project.update',[$project->id])}}

404 Not Found 404 Not Foundhttp://127.0.0.1:8000/project/%24project-%3Eid?activation=1
路由列表:

GET|HEAD        project/create ....................................................................... project.create › ProjectController@create  
GET|HEAD        project/{project} ........................................................................ project.show › ProjectController@show  
PUT|PATCH       project/{project} .................................................................... project.update › ProjectController@update  
DELETE          project/{project} .................................................................. project.destroy › ProjectController@destroy  
GET|HEAD        project/{project}/edit ................................................................... project.edit › ProjectController@edit

知道吗?谢谢

9gm1akwq

9gm1akwq1#

找到了答案,只需要传递$project而不仅仅是id:

<form action="{{route('project.update',$project)}}">

相关问题