Coupons
TheCoupon model (app/Models/Coupon.php) powers the promotional discount engine.
Discount types
Key fields
Validation
Coupon::validate() returns a strongly-typed CouponValidationResult DTO:
Atomic usage tracking
Coupon usage is incremented atomically with pessimistic locking to prevent over-redemption during high-traffic scenarios:Context-aware discounts
Coupon::calculateDiscountWithContext() applies discounts only to eligible items when restricted_to_categories or restricted_to_products is set:
- If both are null: all items are eligible.
- If
restricted_to_productsis set: only matching product IDs are eligible. - If
restricted_to_categoriesis set: only products in those categories are eligible. - If both are set: OR logic — match either restriction.
Campaigns
TheCampaign model manages outbound email campaigns to tenant followers.
AudienceType enum (in app/Domain/Marketing/Enums/) controls recipient targeting.
Manage campaigns in the Filament panel at /app via CampaignResource.
Announcements
TheAnnouncement model creates scheduled banners on the tenant microsite.
starts_at_utc, expires_at_utc) stored in UTC. Active announcements are calculated with:
getContentHtmlAttribute() before rendering to prevent XSS.
Announcement changes automatically invalidate the Inertia shared data cache.
Lead capture
TheLead model captures customer inquiries from the public microsite.
customer_phone, message) is encrypted at rest using Laravel’s encrypted cast for GDPR compliance.
Leads are visible in the Filament panel under Leads/ resources.
Follower system
TheFollow model implements a many-to-many relationship between users and tenants:
FollowerResource in the Filament panel shows the full follower list with counts.
Interaction tracking
Three dedicated redirect routes record interactions before forwarding the user:Interaction (type: whatsapp_click, call_click, maps_click) and counted toward the tenant’s analytics dashboard. Rate-limited to 60 requests per minute per IP.