https://github.com/m-hidayatullahh/laravel-12-service-repository-pattern
Laravel 12 Implementasi Service Repository Pattern
https://github.com/m-hidayatullahh/laravel-12-service-repository-pattern
Last synced: 2 months ago
JSON representation
Laravel 12 Implementasi Service Repository Pattern
- Host: GitHub
- URL: https://github.com/m-hidayatullahh/laravel-12-service-repository-pattern
- Owner: m-hidayatullahh
- Created: 2025-03-04T18:25:01.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-03-04T19:18:19.000Z (3 months ago)
- Last Synced: 2025-03-04T19:36:23.759Z (3 months ago)
- Language: Blade
- Size: 448 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## API Endpoints
### Categories
- **Get all categories**
- **Method:** `GET`
- **URL:** `http://127.0.0.1:8000/api/categories`- **Create a new category**
- **Method:** `POST`
- **URL:** `http://127.0.0.1:8000/api/categories`
- **Headers:** `Content-Type: application/json`
- **Body:**
```json
{
"name": "Web Development",
"description": "Kategori kursus untuk pengembangan web"
}
```- **Get category by ID**
- **Method:** `GET`
- **URL:** `http://127.0.0.1:8000/api/categories/1`- **Update category**
- **Method:** `PUT`
- **URL:** `http://127.0.0.1:8000/api/categories/1`
- **Headers:** `Content-Type: application/json`
- **Body:**
```json
{
"name": "Updated Web Development",
"description": "Kategori kursus yang telah diperbarui"
}
```- **Delete category**
- **Method:** `DELETE`
- **URL:** `http://127.0.0.1:8000/api/categories/1`Dengan langkah-langkah ini, Service Repository Pattern telah diterapkan untuk tabel Categories, membuat kode lebih terstruktur dan mudah dipelihara.
### Courses
- **Get all courses**
- **Method:** `GET`
- **URL:** `http://127.0.0.1:8000/api/courses`- **Create a new course**
- **Method:** `POST`
- **URL:** `http://127.0.0.1:8000/api/courses`
- **Headers:** `Content-Type: application/json`
- **Body:**
```json
{
"title": "Belajar Laravel",
"description": "Kursus Laravel untuk pemula",
"category_id": 1
}
```- **Get course by ID**
- **Method:** `GET`
- **URL:** `http://127.0.0.1:8000/api/courses/1`- **Update course**
- **Method:** `PUT`
- **URL:** `http://127.0.0.1:8000/api/courses/1`
- **Headers:** `Content-Type: application/json`
- **Body:**
```json
{
"title": "Updated Laravel Course",
"description": "Kursus Laravel dengan materi lebih lengkap",
"category_id": 1
}
```- **Delete course**
- **Method:** `DELETE`
- **URL:** `http://127.0.0.1:8000/api/courses/1`Dengan langkah-langkah ini, Service Repository Pattern telah diterapkan untuk Courses, membuat kode lebih modular, terstruktur, dan mudah dipelihara.