Ad

How To Stop GET On A POST Route (laravel)

- 1 answer

I'm new to laraval. I got this POST route but if someone try the address on the browser it become a GET route and laravel throw a error. Is there a way to throw a 404 page for a GET request on POST route.

Route::post('/step2Validate', '[email protected]');

If this route is access as GET "The GET method is not supported for this route. Supported methods: POST." error is given.

Ad

Answer

Try this:

Route::get('/step2Validate', function() { 
    abort(404); 
    }
);
Ad
source: stackoverflow.com
Ad