Download the PHP package dymantic/secretary without Composer
On this page you can find all versions of the php package dymantic/secretary. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dymantic/secretary
More information about dymantic/secretary
Files in dymantic/secretary
Package secretary
Short Description Message and notification system for basic admin sections. It handles contact forms.
License MIT
Informations about the package secretary
Secretary - Handles contact form messages for Laravel projects
A simple way to handle contact forms and such. At the very least, it saves you from having to deal with handling that damn contact form for the millionth time. Simply pass the message to your Secretary and it will handle it accordingly, whether it is sending off an email, Slack message, etc. Database records are kept for each message. Only Email and Slack messages are included out of the box, but it is easy to add your own.
Installation and setup
Step 1: Require with composer
Laravel should auto-discover the ServiceProvider and Facade. If you don't use auto-discovery you can add them yourself to your app config.
Step 2: Publish the config file:
Step 3: Run the migration
Step 4: Set your config accordingly in config/secretary.php
. Below is an example:
Step 5: Use it!
Usage
The general flow is to create a new message that implements Dymantic\Secretary\SecretaryMessage
and then pas it to Secretary's receive
method. This package contains Dymantic\Secretary\ContactMessage
which should be fine for most cases.
The above is the most common use case, so this package includes a form request to simplify the process.
The above will handle basic validation for the name, email address and message body.
Additional message data
Aside from the name. email and message_body fields of a message, there is the message_notes field that holds additional data that can be included as part of the message. You may pass these fields as an associative array with the key 'message_notes' when creating a new message, or you can pass the fields to be plucked from the request if using the ContactForm form request object.
Note: You are responsible for validating the extra fields.
Database messages
Each message received by your Secretary will be saved to the database. The model is Dymantic\Secretary\Message
and is just an eloquent model to be used as such, so you may delete, etc at will. The model does include an archive
method to archive a message, and a reinstate
method which is just the opposite of archive.
The secretary itself has some convenience methods for retrieving messages