如何在 POST 路线上停止 GET (laravel)

How to stop GET on a POST route (laravel)

我是幼虫的新手。我得到了这条 POST 路由,但如果有人在浏览器上尝试该地址,它就会变成一条 GET 路由,并且 laravel 会抛出错误。有没有办法为 POST 路由上的 GET 请求抛出 404 页面。

Route::post('/step2Validate', 'StepController@step2Validate');

如果此路由作为 GET 访问 "The GET method is not supported for this route. Supported methods: POST." 给出错误。

试试这个:

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