indiehd / web-api

GNU Affero General Public License v3.0
6 stars 4 forks source link

Improve apiRoute method, including a new only() method #150

Open cbj4074 opened 5 years ago

cbj4074 commented 5 years ago

Sometimes, it's more useful to specify which API methods we do want, vs. those we don't.

For example this is what's required currently to have only a show method:

$this->apiRoute('featured', 'FeaturedController')
    ->except(['index', 'store', 'update', 'destroy'])
    ->addDefaultRoutes();

This would be much cleaner:

$this->apiRoute('featured', 'FeaturedController')
    ->only(['show'])
    ->addDefaultRoutes();

Also, make any other improvements/adjustments, as necessary, based on experiences thus far.