How to route GET and POST for same pattern in Laravel?

前端 未结 10 2024
余生分开走
余生分开走 2020-12-24 10:55

Does anyone know of any way in Laravel 4 which combines these 2 lines into one?

Route::get(\'login\', \'AuthControl         


        
10条回答
  •  时光取名叫无心
    2020-12-24 11:31

    Route::any('login', 'AuthController@login');
    

    and in controller:

    if (Request::isMethod('post'))
    {
    // ... this is POST method
    }
    if (Request::isMethod('get'))
    {
    // ... this is GET method
    }
    ...
    

提交回复
热议问题