2

As the title mentions, I am trying to figure out how to make a resource group by dingo.

As it explains with laravel, the correct way to make a resource group in route is:

Route::resource('item', 'Api\ItemController');

is it similar with the dingo/api? can I just say:

$api = app('Dingo\Api\Routing\Router');

$api->version('v1', function($api){
    $api->resources('item','App\Http\Controllers\Api\ItemController');
});

When executing this way, i get a type error:

Argument 1 passed to Dingo\Api\Routing\Router::resources() must be of the type array, string given

Does this mean that I have to make an array of all the calls that I need and then pass it to the resources method?

Hoffie
  • 325
  • 2
  • 14

1 Answers1

3

You have a typo there. The actual method is resource not resources

$api->version('v1', function($api){
    $api->resource('item','App\Http\Controllers\Api\ItemController');
});
Nabin Kunwar
  • 1,965
  • 14
  • 29
  • 1
    @Nabim Oh shoot, i missed that. That actually got it to work! thankyou for your quick answer! – Hoffie Mar 17 '16 at 10:12