以下软删除代码对我来说很好用:
$post = Post::find($post_id);
$post->delete();
已更新删除日期字段,但这给了我一个错误:
$post = Post::find($post_id);
$post->restore();
这是错误信息:
exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to a member function restore() on a non-object'
我束手无策。到目前为止,谷歌也没有帮助到我。