Key Eloquent Models
The Portal has 133 Eloquent models in app/Models/. This document covers the most important ones. All models map to tables in the shared MySQL database (also used by API v1 and API v2).
Core Models
User (app/Models/User.php)
The central model for all platform users — students, landlords/agents, moderators, admins, operators, and B2B users. Extends Laravel Authenticatable.
Key fields: id, name, email, role (integer), company_name, city, contact_no, image, last_seen, session_count, status
Traits: HasApiTokens, Notifiable, CompanyScope
Key relationships:
houses()— Houses owned/managed by this agent (hasMany House)likedHouses()/allLikedHouses()— Student’s liked housesdocuments()— Agent documents (hasMany Agent_document)chatRooms()— Chat rooms as tenantagentChatRooms()— Chat rooms as agentcontract()— Contract memberships (hasMany Contract_member)viewingRequest()— Viewing requestsrating()— User rating (hasOne Ratings_user)propertyOperator()— Linked property operator (matched bycompany_name)brandAmbassador()— Brand ambassador recordhuddleContract()— Huddle contractmoderations()— Chat moderations (for moderator users)superAgentStatus()— Super agent statususerSessions()— Login sessions
Scopes: active(), whereIsModerator(), whereIsOperator(), withHouseCount()
InternalUser (app/Models/InternalUser.php)
Separate user model for Housr staff. Uses the internal_users table. Powers the permission system.
Key relationships:
roles()— Many-to-many withRoleviainternal_role_user
Methods: hasRole($role), hasPermission($permission)
House (app/Models/House.php)
Property listings. Uses soft deletes.
Key relationships:
agent()— The landlord/agent who owns this house (hasOne User)liked_houses()/disliked_houses()— User engagementviewing_requests()— Viewing requests for this housebooking_slots()— Available viewing time slotscontract()/activeContract()— Tenancy contractspropertyOperator()— The property operator companyfutureAvailabilities()— Future availability datesboost()— Active boost creditsenvironment()— Environment/regionhousrPlus()— Housr Plus listing flaghouses_viewed()— View tracking
Property_operator (app/Models/Property_operator.php)
Companies that manage properties. Supports a parent-child hierarchy for subsidiaries. Uses soft deletes.
Key relationships:
users()— All users in this company (matched bycompany_name)houses()— All houses managed by this operatorparent()/children()— Company hierarchypropertyOperatorVerification()— Verification status
Contract (app/Models/Contract.php)
Tenancy agreements linking houses to tenants.
Key relationships:
house()— The house under contractcontract_members()— Tenants on this contract (hasMany Contract_member)landlord_rating()— Rating for the landlord on this contract
Enquiry (app/Models/Enquiry.php)
Deprecated — Use Viewing_request instead. Legacy enquiry model linking chat rooms to houses.
Engagement & Communication Models
| Model | Purpose |
|---|---|
Viewing_request | Student viewing requests for houses |
Booking_slot / Booked_slot | Viewing time slot availability and bookings |
Chat_room | Chat conversations between tenants and agents |
Chat_room_member | Members of a chat room |
Chat_room_moderation | Moderator assignments to chat rooms |
Message | Chat messages (Firebase sync) |
Liked_house / Disliked_house | Student house preferences |
House_viewed | House view tracking |
Events & Perks Models
| Model | Purpose |
|---|---|
Event | Events with status, access type, schedule |
EventTicket | Issued tickets for events |
EventRSVP | RSVP responses (going/interested/not_going) |
EventUserApplication | Application-based event access requests |
EventExclusiveUser | Users with exclusive event access |
Perk | Student perks/discounts |
PerkCode | Redeemable perk codes |
Perk_redeemed / Perk_code_redeemed | Redemption tracking |
PerkPartner | Partner companies providing perks |
PerkExclusive / PerkTag / PerkToken | Perk metadata |
Freebie / FreebieRedemption | Free items/offers |
Bills & Payments Models
| Model | Purpose |
|---|---|
BillHouse | Houses enrolled in bills |
BillRegion | Regional bill configuration |
BillTenant | Tenant bill assignments |
Bills_request | Bill service requests |
BillsIncludedAgent / BillsIncludedPrice | Bill pricing details |
Boost_credit | Active boost credits on houses |
Boost_credit_price | Boost credit pricing tiers |
Boost_transaction | Boost purchase transaction records |
Commission | B2B partner commissions |
Administration Models
| Model | Purpose |
|---|---|
Role | Internal roles (table: internal_roles) |
Permission | Internal permissions (table: internal_permissions) |
City | Supported cities |
University | Universities in supported cities |
Environment | Deployment environments/regions |
Feature_flag | Runtime feature flags |
Global_variable | System-wide configuration values |
Advert | In-app advertisements |
Notification / Notification_log / Notification_open | Push notification management |
Drop / Drop_open | Notification drops and engagement tracking |
Content & Moderation Models
| Model | Purpose |
|---|---|
Moderation_note | Notes on moderated content |
Moderation_rating | Ratings for moderation quality |
Ratings_student / Ratings_landlord / Ratings_user | Rating records |
Ratings_dispute / Ratings_period | Rating dispute handling |
Maintenance | Maintenance requests |
Document | Uploaded documents |
User_note | Notes attached to user profiles |
Naming Convention
Models use a mix of naming styles (legacy inconsistency):
- Snake_case:
House_change,Chat_room,Liked_house(older models) - PascalCase:
InternalUser,BillRegion,EventTicket(newer models)
Both styles map to their respective database tables. Some models explicitly set protected $table when the table name does not follow Laravel’s convention.