Package Data | |
---|---|
Maintainer Username: | neilcrookes |
Maintainer Contact: | neil.crookes@fivebyfiveuk.com (Neil Crookes) |
Package Create Date: | 2013-11-26 |
Package Last Update: | 2014-01-17 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-10 15:03:45 |
Package Statistics | |
---|---|
Total Downloads: | 1,055 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 14 |
Total Watchers: | 3 |
Total Forks: | 4 |
Total Open Issues: | 4 |
A Laravel 4 package for adding a simple contact form to a website
Add the following to you composer.json file
"fbf/laravel-contact-form": "dev-master"
Run
composer update
Add the following to app/config/app.php
'Fbf\LaravelContactForm\LaravelContactFormServiceProvider'
Publish the config, then edit it accordingly
php artisan config:publish fbf/laravel-contact-form
Ensure the settings in app/config/mail.php are correct
The URI of contact page
'uri' => 'contact',
The view of the contact page (you can set this to be a view in your app, which has much more contact on it for example, then include the partial for the form, e.g. @include('laravel-contact-form::form')
)
'view' => 'laravel-contact-form::contact',
The fields and rules for your form
'fields' => array(
'title' => array(
'type' => 'select',
'choices' => array(
'' => 'Please select',
'Mr' => 'Mr',
'Mrs' => 'Mrs',
'Miss' => 'Miss',
'Ms' => 'Ms',
'Dr' => 'Dr',
'Other' => 'Other',
),
),
'first_name' => array(
'type' => 'text',
),
'last_name' => array(
'type' => 'text',
),
'email' => array(
'type' => 'text',
),
'enquiry' => array(
'type' => 'textarea',
),
),
'rules' => array(
'title' => 'required',
'first_name' => 'required',
'last_name' => 'required',
'email' => 'required|email',
'enquiry' => 'required',
),
The mail configuration options speak for themselves...
'mail' => array(
'views' => array(
'laravel-contact-form::emails.html.enquiry',
'laravel-contact-form::emails.text.enquiry',
),
'to' => array(
'name' => 'Customer Services Manager',
'email' => 'customer.services@company.com',
),
'subject' => 'Website Enquiry',
),
Customise the options in the config file and then add the following to the view file that you specified in the config to render the contact form inside it.
@include('laravel-contact-form::form')