The following soft delete code works fine for me:
$post = Post::find($post_id);
$post->delete();
The deleted_at field is updated. But this gives me an error:
$post = Post::find($post_id);
$post->restore();
Here's the error:
exception 'SymfonyComponentDebugExceptionFatalErrorException' with message 'Call to a member function restore() on a non-object'
I'm stumped. Google is no help so far.
question from:
https://stackoverflow.com/questions/25576024/laravel-soft-delete-restore-error 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…