我在 web.php 中的路线如下:
$router->post('apiToken', 'AuthController@getApiToken');
$router->group(['middleware' => 'auth:api'], function () use ($router) {
$router->get('users', 'UserController@index');
$router->post('users', 'UserController@store');
$router->get('users/{id}', 'UserController@show');
$router->put('users/{id}', 'UserController@update');
$router->delete('users/{id}', 'UserController@destroy');
});
当我访问路由“apiToken”时,它首先到达 AuthServiceProvider@viaRequest。我不明白为什么?