https://github.com/g3n1us/laravel-model-api
A controller providing a logical url structure for accessing model data
https://github.com/g3n1us/laravel-model-api
Last synced: 2 months ago
JSON representation
A controller providing a logical url structure for accessing model data
- Host: GitHub
- URL: https://github.com/g3n1us/laravel-model-api
- Owner: g3n1us
- Created: 2018-06-03T04:02:40.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-09-27T19:05:03.000Z (over 4 years ago)
- Last Synced: 2025-01-29T07:43:44.988Z (4 months ago)
- Language: PHP
- Size: 46.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# laravel-model-api
A controller providing a logical url structure for accessing model dataUsage: modelname is the snake cased version of the model. If singular, will display either the first model or the one specified by id.
If plural, a paginated list of items will be output.
If html is specified, the __toString method will explicitly be called, returning any overloaded version in the model, usually custom html output.$_GET parameters for plural form only:
`paginate` - 0 results in no pagination, default = 1
`per_page` = results per page, disables pagination, integer default is pagination default, 15
`offset` = offset, return results starting at this offset
`limit` - limit to return, disables pagination
`pluck`/`property` - pluck a value from the returned objects
$_GET parameters for singular form only:
`html` - returns the model's overloaded __toString method instead of the default JSON representation, also an URL parameter