chaky
chaky

Reputation: 137

How to stop GET on a POST route (laravel)

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', 'StepController@step2Validate');

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

Upvotes: 0

Views: 361

Answers (1)

Dimitri Mostrey
Dimitri Mostrey

Reputation: 2340

Try this:

Route::get('/step2Validate', function() { 
    abort(404); 
    }
);

Upvotes: 1

Related Questions