我想恢复在 laravel 中用 softdeletes 删除的帖子:
错误:
ArgumentCountError
Too 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>
慕码人8056858