I'm using Laravel 6.2, and : "dingo/api": "^2.4.0",
I have this code:
$api = app('Dingo\Api\Routing\Router');
$api->version('v1', function ($api) {
$api->resource('security-groups', 'App\Http\Controllers\Api\SecurityGroupsController')->only(['index', 'show']);
});
When I do: php artisan api:routes I get an exception
Symfony\Component\Debug\Exception\FatalThrowableError : Call to a member function only() on null
But If I remove the only at the end, it become working
Also with the apiResource:
$api->apiResource('security-groups', 'App\Http\Controllers\Api\Settings\SecurityGroupsController');
I get an exception as well:
Symfony\Component\Debug\Exception\FatalThrowableError : Call to undefined method
Dingo\Api\Routing\Router::apiResource()