-1

Is there a method to consolidate these two lines into a single line in Laravel 8?

Route::get('register', 'AuthController@getLogin');
Route::post('register', 'AuthController@postLogin');
lagbox
  • 48,571
  • 8
  • 72
  • 83

2 Answers2

2
Route::match(['get', 'post'], '/register', AuthController@getAndPostLogin);

Source: https://laravel.com/docs/9.x/routing#available-router-methods

Musa
  • 1,334
  • 1
  • 11
  • 21
0

For a route, you can use the following syntax to aggregate all HTTP verbs:

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