chairuman
8 months ago
67
30
Laravel

Restore Function return 404 Not Found

Posted 8 months ago by chairuman

i made a soft delete in laravel and i want to restore the delete post, but it return 404 not found, the data are exist in database with delete_at value, can somebody help me?, here my code Route

Route::put('/blog/post/{post}/restore',[
    'uses' => 'Backend\[email protected]',
    'as' => 'post.restore'
]);

Restore Function

public function restore(Post $post)
    {
        $post->onlyTrashed()->restore();
        alert()->success('post has been restore')->persistent('Ok');
        return redirect('/blog/post?status=trash');
    }

Restore button

{!! Form::open(['style' => 'display:inline-block','method' => 'PUT', 'route' => ['post.restore', $post->id]])!!}
      <button title="Restore Post" type="submit" class="btn btn-xs btn-default">
           <i class="fa fa-refresh"></i>
      </button>
{!! Form::close() !!}

Please sign in or create an account to participate in this conversation.