specialtactics / laravel-api-boilerplate

Laravel API Boilerplate | Quickly build quality API products!
MIT License
490 stars 94 forks source link

Named routes not working using dingo api router #25

Closed sunder6218 closed 4 years ago

sunder6218 commented 5 years ago

Hey,

im moving my current project into Api using this boiler plate, and i have noticed that my laravel named routes dont work when using the dingo APi router.

$api->get('/dashboard', 'PagesController@dashboard')->name('dashboard2');

then i get this error from the controller

Route [dashboard2] not defined.

is there a particular reason why this is happening?

thanks

specialtactics commented 5 years ago

Hi

Can you please try the following syntax:

$api->get('/dashboard', [
    'uses' => 'PagesController@dashboard',
    'as' => 'dashboard2',
]);

Also, what exactly are you doing in the controller to get that error?

specialtactics commented 4 years ago

Closing due to lack of feedback in a month.

If you still have this issue, feel free to let me know - but also, probably you actually should submit it in the dingo repo.