app/Models/ and uses $guarded = ['id'] as a baseline mass-assignment guard unless otherwise noted.
Model categories
Core models
Core models
These five models form the heart of the booking workflow.Appended attributes: Accessors
Notable methods
RelationshipsKey accessorsStatic helper
Booking status values
RelationshipsAuto-generated identifiersPruning rule
Relationships
Relationships
User
File:app/Models/User.phpExtends Illuminate\Foundation\Auth\User and uses the HasApiTokens, HasFactory, Notifiable, SoftDeletes, and Notify traits.Key castslast-seen-activity, user_image, fullnameRelationships| Accessor | Returns |
|---|---|
getFullnameAttribute() | firstname + lastname concatenated |
getUserImageAttribute() | File URL via getFile($image_driver, $image) |
getLastSeenActivityAttribute() | true if user-is-online-{id} cache key exists |
The
users table has a role column: 0 = traveller, 1 = vendor. The REST API exposes this as is_vendor boolean in all JSON responses. The same User model handles both roles — role elevation happens when KYC is approved.Package
File:app/Models/Package.phpRepresents a tour package listed by a vendor.Key castsBooking
File:app/Models/Booking.phpRecords a traveller’s reservation for a package. Uses Prunable to auto-delete stale unpaid bookings.Key casts| Value | Meaning |
|---|---|
0 | Pending payment |
1 | Confirmed (accepted by vendor) |
2 | Completed |
3 | Cancelled / rejected |
4 | Refunded |
5 | Processing (awaiting vendor acceptance) |
Review
File:app/Models/Review.phpStores traveller reviews for packages, with threaded replies via parent_review_id.Key castsTop-level reviews have
parent_review_id = null. Reviews must have status = 1 to appear publicly. Reviews with status = 0 are pending admin approval.Destination
File:app/Models/Destination.phpRepresents a Zanzibar or Tanzania tourism destination that packages are grouped under.Key castsCommerce models
Commerce models
These models handle payments, payouts, and vendor subscriptions.TRX ID generation
RelationshipsStatus values:
RelationshipsStatus values:
Scopes
Transaction
File:app/Models/Transaction.phpThe central ledger model. Transaction IDs are prefixed with T and generated inside a database lock to prevent duplicates.RelationshipsDeposit
File:app/Models/Deposit.phpRecords an incoming payment from a user. Transaction IDs are prefixed with D.Key casts0 = pending, 1 = success, 2 = requested (manual), 3 = rejectedPayout
File:app/Models/Payout.phpRecords a vendor withdrawal request. Transaction IDs are prefixed with P.Fillable fields: user_id, payout_method_id, payout_currency_code, amount, charge, net_amount, amount_in_base_currency, charge_in_base_currency, net_amount_in_base_currency, trx_id, status, information, meta_field, feedbackKey casts1 = pending, 2 = approved, 3 = rejectedGateway
File:app/Models/Gateway.phpConfigures automatic and manual payment gateways. Gateways with id < 1000 are automatic; id >= 1000 are manual.Key castsCoupon
File:app/Models/Coupon.phpDiscount codes applicable at checkout.Plan & PlanPurchase
File:app/Models/Plan.php, app/Models/PlanPurchase.phpVendors subscribe to plans that define listing quotas and featured-listing allowances. PlanPurchase records the active subscription per vendor with an expiry_date.Content models
Content models
These models drive the CMS and multi-language content layer.RelationshipsStatic helpers
Blog
File:app/Models/Blog.phpKey castsPage & PageDetail
File:app/Models/Page.php, app/Models/PageDetail.phpCMS pages with per-language detail records in PageDetail.Language
File:app/Models/Language.phpControls the active UI languages across the platform.Content & ContentDetails
File:app/Models/Content.php, app/Models/ContentDetails.phpGeneric translatable content blocks (e.g., hero text, section copy) with per-language detail records in ContentDetails.System models
System models
These models configure global platform behaviour.Read site-wide settings using the
BasicControl
File:app/Models/BasicControl.phpSingleton settings record. Clears the ConfigureSetting cache after every save.basicControl() helper:NotificationTemplate
File:app/Models/NotificationTemplate.phpHolds email and SMS template bodies keyed by a template code (e.g., BOOKING_ACCEPTED, KYC_APPROVED). The Notify trait looks up these templates when sending notifications.Admin
File:app/Models/Admin.phpAdministrator accounts, separate from User. Admins manage the backend panel.Other system models
| Model | Purpose |
|---|---|
ActivityLog | Polymorphic audit trail for packages and users |
InAppNotification | Polymorphic in-app notification records |
FireBaseToken | Polymorphic FCM device tokens for push notifications |
NotificationSettings | Per-user notification preferences |
MaintenanceMode | Toggles site maintenance state |
ManageMenu | Dynamic navigation menu entries |
GoogleMapApi | Google Maps API key configuration |
SmsControl | SMS gateway configuration |
ManualSmsConfig | Manual SMS provider settings |
SupportTicket | User support tickets |
SupportTicketMessage | Messages within a ticket thread |
SupportTicketAttachment | File attachments on ticket messages |
Subscriber | Newsletter subscribers |
Kyc | KYC form schema definitions |
UserKyc | User KYC submission records |
VendorInfo | Extended vendor profile (social links, plan usage) |
Amenity | Package amenity / safety item definitions |
PackageCategory | Tour package categories |
PackageMedia | Gallery images for a package |
PackageVisitor | View-count records per package |
DestinationVisitor | View-count records per destination |
Guide | Tour guide profiles linked to a user via created_by |
Chat | Package-level chat messages |
Country / State / City | Geographic reference data |
Fund | Wallet top-up records |
UserGateway | Per-user gateway configurations for vendor payouts |
RazorpayContact | Razorpay contact records for payout routing |
PayoutMethod | Payout method configurations |
FileStorage | Tracks uploaded file paths and drivers |
Model naming conventions
| Convention | Example |
|---|---|
| Model class | PackageCategory (PascalCase) |
| Table name | package_categories (snake_case plural) |
| Foreign key | package_id, owner_id (snake_case + _id) |
| Polymorphic type | depositable_type / depositable_id |
Guide model — JSON-based relationship
Guide does not use a standard foreign key to link to packages. Instead, package records store an array of guide codes in a JSON column:
User record is found via: