# Mutual Fund — Fund Holding

**Controller:** `App\Http\Controllers\MfFundHoldingController`  
**Model:** `App\Models\MfFundHolding`  
**Table:** `mf_fund_holdings`  
**Middleware:** `jwt.auth`, `check.token`, `dynamic.permission`

A holding is mapped to one fund (`fund_id`). Unique per fund: (`fund_id`, `company_name`, `as_of_date`).

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

---

## Mapping

| Field | References |
|-------|------------|
| `fund_id` | `mf_funds.id` — use `mf-fund-dropdown` |

Index/show also return a nested `fund` object.

## Fields

| Column | Type | Notes |
|--------|------|--------|
| `id` | bigint | PK |
| `fund_id` | bigint | Required |
| `company_name` | varchar(128) | Unique with fund + date |
| `dse_code` | varchar(32) | Optional ticker |
| `sector_name` | varchar(64) | Required |
| `weight_percentage` | decimal(5,2) | 0–100 |
| `cost_value` | decimal(18,2) | Optional |
| `market_value` | decimal(18,2) | Optional |
| `as_of_date` | date | Required |
| `create_by` / `update_by` | int | From JWT / `users_id` |

## Endpoints

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

Update is **POST**, not PUT.

## Query params

**Index:** `per_page`, `fund_id`, `from`, `to`, `q` (company, DSE code, or sector).

**Dropdown:** optional `fund_id`, `as_of_date`. Returns `id`, `fund_id`, `company_name`, `dse_code`, `sector_name`, `weight_percentage`, `as_of_date`.

## Related docs

- cURL: `mf_fund_holding_api_curl.md`
- Postman: `mf_fund_holding.postman_collection.json`
