https://github.com/kevin-kip/rest
Simple REST API in Laravel
https://github.com/kevin-kip/rest
Last synced: 15 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 (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-06-17T12:13:37.000Z (about 7 years ago)
- Last Synced: 2025-03-17T11:30:19.517Z (4 months ago)
- Language: PHP
- Size: 768 KB
- Stars: 1
- Watchers: 0
- 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
```
>### Retrieving One Item
```php
return ModelName::findOrFail($id);
```
```
http://localhost:8000/products/4
```
>### 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:

>### Delete Item
Sending a **DELETE** request```php
(ModelName::findOrFail($id))->delete();
```

### Resources update coming soon ...