# Mutual Fund — Sector Allocation

**Controller:** `App\Http\Controllers\MfSectorAllocationController`  
**Model:** `App\Models\MfSectorAllocation`  
**Table:** `mf_sector_allocations`  
**Middleware:** `jwt.auth`, `check.token`, `dynamic.permission`

A sector allocation is mapped to one fund (`fund_id`). Unique per fund: (`fund_id`, `sector_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 |
| `sector_name` | varchar(64) | Unique with fund + date |
| `allocation_percentage` | decimal(5,2) | 0–100 |
| `as_of_date` | date | Required |
| `create_by` / `update_by` | int | From JWT / `users_id` |

## Endpoints

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

Update is **POST**, not PUT.

## Query params

**Index:** `per_page`, `fund_id`, `from`, `to`, `q` (sector name).

**Dropdown:** optional `fund_id`, `as_of_date`. Returns `id`, `fund_id`, `sector_name`, `allocation_percentage`, `as_of_date`.

## Related docs

- cURL: `mf_sector_allocation_api_curl.md`
- Postman: `mf_sector_allocation.postman_collection.json`
