Skip to content

Config Reference

config/multidomain.php

KeyEnvDefaultPurpose
main_domainAPP_MAIN_DOMAINlocalhostBase domain every portal is derived from
single_domainAPP_SINGLE_DOMAINfalseCollapse all portals onto main_domain — see Single vs Multi Domain
sub_domainsderivedArray of portal key → resolved domain (app, backoffice, landing, account, auth, api)
registerable_portals[]Portal roles a visitor can self-select on the public register page — see make:subdomain § self-registration

Demo auth settings (config/multidomain.php)

Settings for the worked example auth flow — see the Auth portal for how each is used. Not part of the core multidomain routing.

KeyEnvDefaultPurpose
email_verification_grace_daysEMAIL_VERIFICATION_GRACE_DAYS7Days before an unverified email hard-blocks app/backoffice access
phone_verification_enabledPHONE_VERIFICATION_ENABLEDfalseTurns the entire phone/OTP flow on or off. When off, phone fields, gates, and account settings all behave as if verified
phone_country_modePHONE_COUNTRY_MODEsinglesingle = one fixed country code, no field shown; multi = free-text country code, no real validation
phone_default_country_codePHONE_DEFAULT_COUNTRY_CODE+91Fixed code used in single mode
otp.expires_minutesOTP_EXPIRES_MINUTES10How long a generated OTP stays valid
otp.max_attempts5Wrong-code attempts before a 5-minute verify lockout
otp.resend_cooldown60 (seconds)Minimum wait between resends
otp.resend_max_attempts3Resends allowed per lockout window
otp.resend_lockout_seconds86400Window before resend attempts reset

Portal → role mapping

App\Http\Middleware\EnsurePortalAccess (alias portal:{user|staff}) redirects a request to the correct portal if the authenticated user's role doesn't match. It relies on two methods on your user model:

php
$user->isStaff(): bool
$user->redirect(): string   // route name/URL to send a mismatched user to

App\Models\User implements both today via a privilege column — swap these out for your own role system, the middleware doesn't care how they're implemented.

Core vs demo middleware

Registered in bootstrap/app.php:

AliasClass
guestApp\Http\Middleware\RedirectIfAuthenticatedcore
portalApp\Http\Middleware\EnsurePortalAccesscore
phone.verifiedApp\Http\Middleware\Demo\EnsurePhoneIsVerifieddemo/example
email.graceApp\Http\Middleware\Demo\EnsureEmailVerificationNotExpireddemo/example
staffApp\Http\Middleware\Demo\EnsureIsStaffdemo/example

The "demo" ones implement this starter kit's worked example (phone OTP + email grace period) — replace or delete them for your own app; they're not required for the portal/subdomain mechanism itself.