# Models

Eloquent models for the application. Models use non-standard naming conventions throughout: custom table names (`tbl_*`), custom primary keys, Hungarian notation for columns, and no timestamps by default.

## Hungarian Notation Reference

| Prefix | Type | Examples |
|--------|------|---------|
| `v` | String (varchar) | `vEmail`, `vName`, `vHashedEmail` |
| `i` | Integer | `iUserID`, `iProgramID`, `iActiveDayID` |
| `b` | Boolean | `bActive`, `bDeleted`, `bSubscribed` |
| `d` | Date/datetime | `dCreated`, `dModified`, `dExpiry` |
| `dec` | Decimal | `decPrice`, `decDiscount` |
| `set` | Set/array | `setNicotineTypes` |

## Files

| Model | Table Name | Primary Key |
|-------|------------|-------------|
| `Admin` | `tbl_Admin` | `iAdminId` |
| `ApiTiming` | `api_timings` | `id` |
| `Article` | `tbl_Articles` | `iArticleId` |
| `Chapter` | *dynamic:* `tbl_{programId}Chapters` | `iChapterId` |
| `Coupon` | `tbl_Coupons` | `iCouponId` |
| `CouponType` | `tbl_CouponTypes` | `iCouponTypeId` |
| `Currency` | `tbl_Currency` | `iCurrencyId` |
| `FailedUserPayment` | `tbl_FailedUserPayment` | `id` |
| `Language` | `tbl_Languages` | `iLanguageId` |
| `Log` | `logs` | `id` |
| `Login` | `tbl_Login` | `iLoginId` |
| `OnBoarding` | `tbl_OnBoarding` | `iOnBoardingId` |
| `Partner` | `tbl_Partners` | `iPartnerId` |
| `PartnerEvent` | `tbl_PartnerEvents` | `id` |
| `PersonalityType` | `tbl_PersonalityTypes` | `id` |
| `ProductCode` | `tbl_ProductCodes` | `iProductCodeId` |
| `Program` | `tbl_Programs` | `iProgramID` |
| `RazorpayListener` | `tbl_RazorpayListener` | `Id` |
| `SQLLog` | `sql_logs` | `id` |
| `StripeListener` | `tbl_StripeListener` | `id` |
| `SubModule` | *dynamic:* `tbl_{programId}SubModules` | `iSubModuleId` |
| `SubScreen` | `tbl_SubScreens` | `iSubScreenId` |
| `TransactEmail` | `tbl_TransactEmails` | `vHashedEmail` |
| `User` | `tbl_Users` | `iUserID` |
| `UserActivity` | *dynamic:* `tbl_User{programId}Activity` | `iUserActivityID` |
| `UserAngel` | `tbl_UserAngels` | `iUserAngelId` |
| `UserAppActivity` | `tbl_UserAppActivity` | `iUserId` |
| `UserChapter` | *dynamic:* `tbl_User{programId}Chapters` | `iUserChapterID` |
| `UserConfig` | `tbl_UserConfig` | `iUserID` |
| `UserData` | `tbl_UserData` | `iUserId` |
| `UserDay` | *dynamic:* `tbl_User{programId}Days` | `iUserDayID` |
| `UserEmail` | `tbl_UserEmails` | `iUserId` |
| `UserInfo` | `tbl_UserInfo` | `iUserID` |
| `UserProfile` | `tbl_UserProfile` | `iUserID` |
| `UserProgram` | `tbl_UserPrograms` | `iUserProgramID` |
| `UserQuitStatus` | `tbl_UserQuitStatus` | `id` |
| `UserRazorPayment` | `tbl_UserRazorPayments` | `id` |
| `UserSSO` | `tbl_UserSSO` | `id` |
| `UserSource` | `tbl_UserSources` | `iUserSourceId` |
| `UserSubHistory` | `tbl_UserSubHistory` | `ID` |
| `UserSubmoduleFeedback` | *dynamic:* `tbl_User{programId}SubmoduleFeedback` | `id` |
| `UserSubscription` | `tbl_UserSubscriptions` | `id` |
| `Voucher` | `tbl_Vouchers` | `iVoucherID` |
| `VoucherType` | `tbl_VoucherType` | `iVoucherType` |
| `WebLoginDiscount` | `tbl_WebLoginDiscount` | `id` |

## Notable Patterns

- **Dynamic tables**: 6 models resolve their table at runtime via `forProgram($programId)`: Chapter, SubModule, UserActivity, UserChapter, UserDay, UserSubmoduleFeedback
- **Non-integer PK**: `TransactEmail` uses `vHashedEmail` (string) as primary key with `$incrementing = false`
- **Alternate connections**: `Log` and `SQLLog` use the `logs` DB connection; `UserInfo` uses the `qsuserinfo` connection
- **No timestamps**: Models set `$timestamps = false` by default
- **Soft deletes**: Handled via a `bDeleted` column (manual filtering) rather than Laravel's SoftDeletes trait
