Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kevin-kip/rest
Simple REST API in Laravel
https://github.com/kevin-kip/rest
Last synced: 2 days ago
JSON representation
Simple REST API in Laravel
- Host: GitHub
- URL: https://github.com/kevin-kip/rest
- Owner: Kevin-Kip
- Created: 2018-06-17T12:12:19.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-17T12:13:37.000Z (over 6 years ago)
- Last Synced: 2024-11-23T15:36:16.704Z (2 months ago)
- Language: PHP
- Size: 768 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## REST and Read
This is a simple REST API built using Laravel (Before the Laravel Resources era :smile:)>It shows the basic **API CRUD** operations in Laravel 5.5
## The Result?
>### Retrieving All Items```php
return ModelName::all();
``````
http://localhost:8000/products
```![screenshot1](screenshots/screenshot1.png)
>### Retrieving One Item
```php
return ModelName::findOrFail($id);
```
```
http://localhost:8000/products/4
```
![screenshot1](screenshots/screenshot2.png)>### Update
Sending a **PUT** request```php
(ModelName::findOrFail($id))->update($request->all());
```This isn't how the code is written. Am just showing what's happening :smiley:
![screenshot1](screenshots/screenshot3.png)
>### Delete Item
Sending a **DELETE** request```php
(ModelName::findOrFail($id))->delete();
```
![Screenshot4](/screenshots/screenshot4.png)
### Resources update coming soon ...