Database
Shared Database Architecture
The Portal, API v1, and API v2 all connect to the same MySQL database. This means:
- Models in the Portal read and write the same rows that the APIs use.
- Schema changes must be coordinated across all three applications.
- There is no separate “portal database” — it is one shared MySQL instance.
The database connection is configured in config/database.php using standard Laravel MySQL settings:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=housr
DB_USERNAME=forge
DB_PASSWORD=The strict mode is set to false to maintain compatibility with the existing schema.
Key Tables
Users & Auth
| Table | Model | Notes |
|---|---|---|
users | User | All platform users (students, agents, moderators, admins, B2B). Role in role column. |
internal_users | InternalUser | Housr staff accounts for admin panel access |
internal_roles | Role | Staff role definitions |
internal_permissions | Permission | Granular permission definitions |
internal_role_user | — | Pivot: internal users to roles |
internal_permission_role | — | Pivot: roles to permissions |
password_reset_links | Password_reset_link | Password reset tokens |
user_sessions | UserSession | Login session tracking |
bypass_codes | BypassCode | Auth bypass codes |
Properties
| Table | Model | Notes |
|---|---|---|
houses | House | Property listings (soft deletes) |
property_operators | Property_operator | Companies managing properties (soft deletes, parent-child hierarchy) |
property_operator_verifications | PropertyOperatorVerification | Operator verification status |
house_image_rooms | House_image_room | Room images for houses |
future_house_availabilities | Future_house_availability | Future availability dates |
featured_houses | Featured_house | Featured/promoted houses |
house_changes | House_change | Audit trail for house edits |
house_viewed | House_viewed | View tracking |
building_details | BuildingDetail | Additional building information |
Enquiries & Viewings
| Table | Model | Notes |
|---|---|---|
viewing_requests | Viewing_request | Student viewing requests |
viewing_request_status_changes | Viewing_request_status_change | Status audit trail |
booking_slots | Booking_slot | Available viewing times |
booked_slots | Booked_slot | Confirmed viewing bookings |
enquiries | Enquiry | Deprecated — legacy enquiry records |
enquiry_status_changes | Enquiry_status_change | Legacy enquiry status trail |
website_enquiries | Website_enquiry | Enquiries from the website |
concierge_direct_transfers | Concierge_direct_transfer | Direct concierge transfers |
Communication
| Table | Model | Notes |
|---|---|---|
chat_rooms | Chat_room | Chat conversations |
chat_room_members | Chat_room_member | Chat participants |
chat_room_moderations | Chat_room_moderation | Moderator assignments |
messages | Message | Chat messages (synced with Firebase) |
Contracts
| Table | Model | Notes |
|---|---|---|
contracts | Contract | Tenancy agreements |
contract_members | Contract_member | Tenants on a contract |
huddle_contracts | Huddle_contract | Huddle integration contracts |
documents | Document | Contract and other documents |
Events
| Table | Model | Notes |
|---|---|---|
events | Event | Events with status, access_type, schedule |
event_tickets | EventTicket | Issued tickets |
event_rsvps | EventRSVP | RSVP responses |
event_user_applications | EventUserApplication | Application-based access requests |
event_exclusive_users | EventExclusiveUser | Users with exclusive access |
Perks & Freebies
| Table | Model | Notes |
|---|---|---|
perks | Perk | Student perks/discounts |
perk_codes | PerkCode | Redeemable codes |
perk_partners | PerkPartner | Partner companies |
freebies | Freebie | Free item offers |
freebie_redemptions | FreebieRedemption | Redemption records |
Bills & Payments
| Table | Model | Notes |
|---|---|---|
bill_houses | BillHouse | Houses enrolled in bills |
bill_regions | BillRegion | Regional bill config |
bill_tenants | BillTenant | Tenant bill assignments |
bills_requests | Bills_request | Bill service requests |
boost_credits | Boost_credit | Active boost credits |
boost_credit_prices | Boost_credit_price | Pricing tiers |
boost_transactions | Boost_transaction | Purchase records |
commissions | Commission | B2B commissions |
Moderation & Ratings
| Table | Model | Notes |
|---|---|---|
moderation_notes | Moderation_note | Moderation notes |
moderation_ratings | Moderation_rating | Moderation quality ratings |
ratings_students | Ratings_student | Student ratings |
ratings_landlords | Ratings_landlord | Landlord ratings |
ratings_disputes | Ratings_dispute | Rating disputes |
ratings_periods | Ratings_period | Rating period definitions |
Configuration & System
| Table | Model | Notes |
|---|---|---|
cities | City | Supported cities |
universities | University | Universities |
environments | Environment | Deployment environments |
feature_flags | Feature_flag | Runtime feature toggles |
global_variables | Global_variable | System-wide config values |
search_areas | SearchArea | Search area boundaries |
geofences | Geofence | Geographic boundaries |
Notifications
| Table | Model | Notes |
|---|---|---|
notifications | Notification | Push notification definitions |
notification_logs | Notification_log | Send logs |
notification_opens | Notification_open / NotificationOpen | Open/engagement tracking |
drops | Drop | Notification drops |
drop_opens | Drop_open | Drop engagement |
portal_notifications | Portal_notification | In-portal notifications |
Data Integrity Notes
- The Portal does not own the database schema — migrations exist but the canonical schema is shared with the API repos.
- Many models use
$guarded = [](mass assignment unprotected) for flexibility. - Some models explicitly set
public $timestamps = falsewhen the table lackscreated_at/updated_atcolumns. - Soft deletes are used on
HouseandProperty_operatormodels. - The
CompanyScopetrait onUserallows scoping queries bycompany_namefor multi-tenant operator views.
Last updated on