Contacts
A public contact form at /contact and the inbox it fills at /admin/contacts. Messages are mailed to the admins with a copy to the sender, and a reply from the inbox goes out by mail.


What it adds
| File | Purpose |
|---|---|
app/Models/ContactSubmission.php | Name, email, subject, message, status, IP, reply and reply timestamp |
database/factories/ContactSubmissionFactory.php | Factory with a replied state |
database/migrations/*_create_contact_submissions_table.php | |
app/Livewire/ContactForm.php and its view | The public form, in the user shell |
app/Livewire/Admin/Contacts/ContactList.php and its view | The inbox |
app/Mail/ContactSubmittedMail.php, ContactConfirmationMail.php, ContactReplyMail.php, resources/views/mail/contact/* | The three mailables and their markdown views |
Install
php artisan ui-kit:install-module contacts
No Composer packages. Mail goes through your queue, so run php artisan queue:work unless QUEUE_CONNECTION=sync, and set MAIL_FROM_ADDRESS.
What the installer changes
- Adds
/contactbetween the public-routes markers inroutes/ui-kit-user.php, the group open to guests, and the inbox route between the markers inroutes/admin.php. - Adds a
Contactsentry with theunread_contactsbadge inconfig/admin.php. The kit's default badge resolver fills it fromContactSubmission::unread()(unread and not archived), so it works with no code. - Runs the migration.
Routes
| Route | Name |
|---|---|
GET /contact | contact |
GET /admin/contacts | admin.contacts.index |
If your app already has a /contact page, rename the kit's path in routes/ui-kit-user.php, or delete the line; Troubleshooting has the details.
The form
Name, email, a subject and a message, for guests and signed-in users alike; a signed-in user's name and email are filled in. The subjects are a list in config/ui-kit.php, five neutral labels to start with:
'contacts' => [
'subjects' => [
'General question',
'Account or billing',
'Problem report',
'Feature suggestion',
'Something else',
],
],
The chosen label is stored as the message's subject and is checked against that list. The message must be 10 to 5,000 characters. On success the message is saved with the sender's IP, the admins get a ContactSubmittedMail (replying to it writes to the sender) and the sender a ContactConfirmationMail with a copy of what they wrote, and the form gives way to a thank-you with a Send another button.
Two guards: a honeypot field, visually hidden, out of the tab order and never autofilled, which a form-filling bot fills and a person never sees (a filled one shows the same thank-you and saves nothing); and three messages an hour per IP address, counted only once a message passes validation, so a typo never uses up an attempt. Behind a proxy the limit needs trusted proxies, or every visitor shares one address.
The inbox


Four stat tiles count the messages in the inbox, unread, replied and archived. A search field (name, email or subject) and a status filter sit over a table: a select column, the message (subject, then sender and address), a status badge from ContactSubmission::statusTone(), when it arrived, and an Open button. Selecting anything shows a bulk bar with Mark read, Mark unread, Archive and Delete.
Open shows the message in a ds::modal, with a reply box and the per-message actions. Send Reply saves the reply, marks the message replied and sends a ContactReplyMail to the sender: subject "Re: …", the reply first, then their message quoted. The inbox says "Reply sent to …", or, when the mail fails, "Reply saved, but the email failed: …" with the reason, and the reply stays saved either way.
Archiving sets archived_at rather than a status: an archived message leaves the inbox and its counts, and shows under the Archived filter, where it can be unarchived.
| Mailable | Sent when | To |
|---|---|---|
ContactSubmittedMail | Someone sends the form | The admins; replying to it writes to the sender |
ContactConfirmationMail | The same | The sender, with a copy of the message |
ContactReplyMail | An admin replies in the inbox | The sender |
"The admins" are UiKit::admins(), or the addresses in UI_KIT_ADMIN_ADDRESSES (Customising). The doctor's contacts mail views published row checks every class and view.
With support tickets
When the support-tickets module is also installed, each message gets a Copy to Ticket button that opens a ticket for the sender with the message as the first reply.
Removing
Delete the model, factory, both Livewire components and their views, the mailables and resources/views/mail/contact/, remove the route lines from routes/ui-kit-user.php and routes/admin.php and the nav entry between their markers, drop contact_submissions, and remove contacts from installed_modules.