dingo / api

A RESTful API package for the Laravel and Lumen frameworks.
BSD 3-Clause "New" or "Revised" License
9.33k stars 1.25k forks source link

Add array route support #1693

Closed faytekin closed 4 years ago

faytekin commented 4 years ago

To have more readable codes, small changes have been done. In Route, Controller names are given as arrays.

Example

use App\Api\V1\Controllers\LoginController;
$api->post('login', [LoginController::class, 'login']);
taliptako commented 4 years ago

@jasonlew @specialtactics Can you please merge this?

specialtactics commented 4 years ago

Sorry, but I don't agree that this is more readable - it creates ambiguity because it is not clear what those array elements mean and what they relate to.

It is also not the way documented on the Laravel docs.

faytekin commented 4 years ago

I think there has been a misunderstanding. You can set a route in this way at @specialtactics Laravel's own router. But this feature does not exist in Dingo API. I made it as an option. It does not break the current router. Anyone may use or just continue the current one.

specialtactics commented 4 years ago

Hey @faytekin that's fine in that case, I just requested one change which is to put a comment donoting what the code does.

Also there is a merge conflict with that file which you need to resolve.

specialtactics commented 4 years ago

Merged, tagged

Thanks for your contribution !