Pradyumna Challa
Pradyumna Challa

Reputation: 1145

Laravel 5 redirecting back with post request

I have a page that is a POST route. This page has a delete button that routes to one more POST route , where I delete the specified database row and redirect back to the first page.

The problem is that when I use any of 'back()' or 'redirect()' functions it seems that they are producing a GET request to the previous URL. But the previous page is a POST only page.

How can I redirect back with a POST request and POST data ?

Upvotes: 0

Views: 1088

Answers (1)

Christos Lytras
Christos Lytras

Reputation: 37327

You can use redirect()->back()->withInput(); to redirect back with all POST data.

See: https://laravel.com/docs/5.0/responses#redirects and https://laravel.com/docs/5.2/responses#redirects

Upvotes: 0

Related Questions