我想恢复在 laravel 中用 softdeletes 删除的帖子:错误:ArgumentCountErrorToo few arguments to function App\Http\Controllers\PostController::restore(), 0 passed and exactly 1 expected帖子控制器:public function restore($id){ $post= Post::withTrashed()->findOrFail($id); $post->restore(); return redirect()->action('PostController@index');}路线:Route::get('dashboard/posts/restore', 'PostController@restore');标签在trash.blade.php中<a href="{{ action('PostController@restore', ['post' => $post->id]) }}" data-toggle="tooltip" data-placement="top" data-original-title="restore"></a>
1 回答
慕码人8056858
TA贡献1803条经验 获得超6个赞
您需要指定您的路线接受一个参数:
Route::get('dashboard/posts/restore/{post}', 'PostController@restore');
- 1 回答
- 0 关注
- 72 浏览
添加回答
举报
0/150
提交
取消