nf / contact-form
联系表单包
7.0.0
2019-09-27 03:47 UTC
Requires
- php: >=5.6
- guzzlehttp/guzzle: ^6.3
- league/csv: ^8.0
- nf/core: >=2.0
- nf/form: ^1.0
- dev-master
- 7.0.0
- 6.0.0
- v5.0.1
- 5.0.0
- 4.0.0
- v3.18
- v3.17
- 3.1.8
- v3.1.3
- v3.1.2
- v3.1.1
- v3.1.0
- v3.0.9
- v3.0.8
- v3.0.7
- v3.0.6
- v3.0.5
- v3.0.4
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- v2.0.9
- v2.0.8
- v2.0.7
- v2.0.6
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-dependabot/npm_and_yarn/express-4.18.2
- dev-dependabot/npm_and_yarn/qs-6.3.3
- dev-dependabot/npm_and_yarn/css-what-2.1.3
- dev-dependabot/npm_and_yarn/node-sass-7.0.0
- dev-dependabot/npm_and_yarn/tar-2.2.2
- dev-dependabot/npm_and_yarn/dns-packet-1.3.4
- dev-dependabot/npm_and_yarn/hosted-git-info-2.8.9
- dev-dependabot/npm_and_yarn/lodash-4.17.21
- dev-dependabot/npm_and_yarn/y18n-3.2.2
- dev-dependabot/npm_and_yarn/elliptic-6.5.4
- dev-dependabot/npm_and_yarn/ini-1.3.7
- dev-dependabot/npm_and_yarn/http-proxy-1.18.1
- dev-dependabot/npm_and_yarn/lodash.mergewith-4.6.2
- dev-dependabot/npm_and_yarn/websocket-extensions-0.1.4
- dev-dependabot/npm_and_yarn/jquery-3.5.0
This package is auto-updated.
Last update: 2024-09-07 20:55:55 UTC
README
安装迁移和表单包。
需要安装迁移和表单包
请参考此处说明
安装
通过Composer安装
composer require nf/contact-form
添加服务提供者
打开config/app.php
并注册所需的服务提供者。
'providers' => [ // .... Others providers \Vicoders\ContactForm\ContactFormServiceProvider::class ],
运行迁移命令
运行以下命令以创建所需文件并迁移数据库
// publish needed file
php command contact:publish
// migrate database
php command migrate
注册您的选项方案
您可以将您的选项方案添加到
functions.php
所有支持的类型都可以在此找到
use Vicoders\Input\Abstracts\Input; use Vicoders\Input\Abstracts\Type; use Vicoders\ContactForm\Facades\ContactFormManager; ContactFormManager::add([ 'name' => 'Contact', 'type' => Type::CONTACT, 'style' => 'form-1', 'email_enable' => true, /* default - false */ 'email_variables' => [ 'name' => 'NAME_FIELD', 'email' => 'EMAIL_FIELD' ], 'email_config' => [ 'domain_api' => 'http://sendmail.vicoders.com/', 'mail_host' => 'HOST MAIL', 'mail_port' => 'PORT', 'mail_from' => 'EMAIL_FROM', 'mail_name' => 'YOUR NAME', 'mail_username' => 'EMAIL SEND', 'mail_password' => 'EMAIL PASSWORD', 'mail_encryption' => 'tls', ], 'email_template' => [ [ 'name' => 'Template 1', 'path' => 'PATH_TO_HTML_TEMPLATE', 'params' => [ 'name_author' => 'Garung 123', 'post_title' => 'this is title 123', 'content' => 'this is content 123', 'link' => 'http://google.com', 'site_url' => site_url(), ] ], [ 'name' => 'Template 2', 'path' => 'PATH_TO_HTML_TEMPLATE', 'params' => [ 'example_variable' => 'demo' ] ] ], 'status' => [ [ 'id' => 1, 'name' => 'pending', 'is_default' => true ], [ 'id' => 2, 'name' => 'confirmed', 'is_default' => false ], [ 'id' => 3, 'name' => 'cancel', 'is_default' => false ], [ 'id' => 4, 'name' => 'complete', 'is_default' => false ] ], 'fields' => [ [ 'label' => 'Text', 'name' => 'firstname', // the key of option 'type' => Input::TEXT, 'attributes' => [ 'required' => true, 'class' => 'col-sm-6 form-control', 'placeholder' => 'Please fill field', ], ], [ 'label' => 'Text', 'name' => 'lastname', // the key of option 'type' => Input::TEXT, 'attributes' => [ 'required' => true, 'class' => 'col-sm-6 form-control', 'placeholder' => 'Please fill field', ], ], [ 'label' => 'Email', 'name' => 'email', // the key of option 'type' => Input::EMAIL, 'attributes' => [ 'required' => true, 'class' => 'col-sm-12 form-control', 'placeholder' => 'Please fill field', ], ], [ 'label' => 'Phone', 'name' => 'phone', 'type' => Input::TEXT, 'attributes' => [ 'required' => true, 'class' => 'col-sm-12 form-control', 'placeholder' => 'Please fill field', ], ], [ 'label' => 'Choose Size', 'name' => 'choose-size', 'type' => Input::SELECT, 'list' => [ '0' => '--- option ---', 'size-l' => 'Size L', 'size-x' => 'Size X', 'size-xl' => 'Size XL', ], 'selected' => 'size-xl', 'selectAttributes' => [ 'class' => 'col-sm-12 form-control', ], 'optionsAttributes' => [ 'placeholder' => 'Please fill field', 'required' => true, ], ], [ 'label' => 'Textarea', 'name' => 'textarea', 'type' => Input::TEXTAREA, 'attributes' => [ 'required' => true, 'class' => 'col-sm-12 form-control', 'placeholder' => 'Please fill field', ], ], [ 'name' => 'date', 'type' => Input::DATE, 'attributes' => [ 'required' => 'true', 'class' => 'col-sm-12 form-control email-inp-wrap', 'placeholder' => __('Hãy nhập email của bạn', 'contactmodule'), ], ], [ 'value' => 'Submit', 'type' => Input::SUBMIT, 'attributes' => [ 'class' => 'btn btn-primary btn-submit', 'placeholder' => __('Hãy nhập email của bạn', 'contactmodule'), ], ], ], ]);
如果
selected
属性未设置在Input::SELECT中,它将自动检查当前页面的标题与您在list
属性中设置的列表项。
如何使用
该包创建了一个名为nf_contact_form
的短代码,具有name
属性,您可以在任何需要的地方使用它
[nf_contact_form name="{form_name}"]
示例
[nf_contact_form name="Contact"]
do_shortcode("[nf_contact_form name='Contact']")
分页器的自定义布局
{提示}您可以通过添加新的模板文件
resources/views/vendor/option/pagination/default.blade.php
来更改分页的布局