# Mutual Fund — FAQ

**Controller:** `App\Http\Controllers\MfFaqController`  
**Model:** `App\Models\MfFaq`  
**Table:** `mf_faqs`  
**Middleware:** `jwt.auth`, `check.token`, `dynamic.permission`

Assign these route names to the back-office role in route-API permissions before calling them.

---

## Purpose

Master data for mutual-fund FAQs shown in the product/help UI. Rows are ordered by `sort_order`.

## Fields

| Column | Type | Notes |
|--------|------|--------|
| `id` | bigint | PK |
| `question` | varchar(255) | Unique |
| `answer` | mediumtext | Required |
| `sort_order` | int | Display order. Auto `max + 1` on create if omitted |
| `create_by` | int | `fintra_back_users.user_id` |
| `create_at` | datetime | Eloquent `CREATED_AT` |
| `update_by` | int | nullable |
| `update_at` | datetime | Eloquent `UPDATED_AT` |

`create_by` / `update_by` are taken from the JWT user (`user_id`). You may also send `users_id` in the body as a fallback.

## Endpoints

| Action | Method | Path | Route name |
|--------|--------|------|------------|
| List | GET | `/api/mf-faq/mf-faq-index` | `mf-faq-index` |
| Show | GET | `/api/mf-faq/mf-faq-show/{id}` | `mf-faq-show/{id}` |
| Dropdown | GET | `/api/mf-faq/mf-faq-dropdown` | `mf-faq-dropdown` |
| Create | POST | `/api/mf-faq/mf-faq-store` | `mf-faq-store` |
| Update | POST | `/api/mf-faq/mf-faq-update/{id}` | `mf-faq-update/{id}` |
| Delete | DELETE | `/api/mf-faq/mf-faq-delete/{id}` | `mf-faq-delete/{id}` |

Update is **POST**, not PUT.

## Query params

**Index**

| Param | Default | Description |
|-------|---------|-------------|
| `per_page` | 10 | 1–100 |
| `page` | 1 | Laravel paginator |
| `q` | — | Search `question` or `answer` |

**Dropdown**

Returns `id`, `question`, `sort_order` (no pagination), ordered by `sort_order`.

## Response shape

Same as the other Mutual Fund master APIs:

```json
{
  "status": true,
  "message": "FAQ created successfully",
  "data": {}
}
```

List also includes `pagination`: `current_page`, `last_page`, `per_page`, `total`.

Empty index returns **404** with `"No FAQs found"`. Empty dropdown returns **200** with `"data": []`.

## Related docs

- cURL: `mf_faq_api_curl.md`
- Postman: `mf_faq.postman_collection.json`
