cachethq / core

🚦 The core of Cachet, the open-source status page system.
https://cachethq.io
MIT License
101 stars 20 forks source link

Simplify API Route Registration #42

Closed joelbutcher closed 9 months ago

joelbutcher commented 9 months ago

This PR simplifies the registration of API routes, by combining related registration declarations into a single apiResource declaration.

Most resources can be bundled together via Route::apiResources([...]). However, the scoped resources incidents.updates and metrics.points have to be registered as separate Route::apiResource(...) to accommodate correctly scoping resources to their parents as well as defining the route param names used by Laravel's implicit route binding (thus removing the requirement to alter the variable names type hinted in the controllers... e.g. renaming $incidentUpdate to just $update)