I created 2 route groups in my api route file, and I can't access to routes of second group.
First group :
$api = app('Dingo\Api\Routing\Router');
$request = app('\Dingo\Api\Http\Request');
$api->dispatch($request);
/* API V1 ROUTES */
$prefix = 'test';
$api->group(['prefix' => $prefix,'version'=> 'v1'],function($api) {
$api->post('/entity/validate/{code}', [
'as' => 'validate.code',
'uses' => 'App\Http\Controllers\XXX\Api\SmsController@validateCodeV1',
]);
});
This is working perfectly and I reach my function validateCodeV1 that does perfectly its job. On another side I have right after it Second group :
$prefix = 'testv2';
$api->group(['prefix' => $prefix,'version'=> 'v2'],function($api) {
$api->post('/entity/validate/{code}', [
'as' => 'validate.code',
'uses' => 'App\Http\Controllers\XXX\Api\SmsController@validateCode',
]);
});
Here I have a 404 when I try to call my api with a prefix testv2/entity/validate/XXX
I don't know how I can specify properly my prefix to swap from my v1 route to my v2 route... I use Laravel 5.5
EDIT : check of routes is empty, even after cache clear :
php artisan route:list | grep entity/validate
| | POST | /test/entity/validate/{code} | validate.code | Closure | api.controllers |
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire