contact form db changes
This commit is contained in:
parent
8655daf30a
commit
4f3c20e76a
|
|
@ -189,6 +189,7 @@ return [
|
|||
'email' => 'Email',
|
||||
'name' => 'Name',
|
||||
'surname' => 'Surname',
|
||||
'mobile' => 'Phone number',
|
||||
],
|
||||
|
||||
];
|
||||
|
|
|
|||
|
|
@ -189,6 +189,7 @@ return [
|
|||
'email' => 'эл. адрес',
|
||||
'name' => 'Имя',
|
||||
'surname' => 'Фаимилия',
|
||||
'mobile' => 'Номер телефона',
|
||||
],
|
||||
|
||||
];
|
||||
|
|
|
|||
|
|
@ -191,6 +191,7 @@ return [
|
|||
'email' => 'El. bukjaňyz',
|
||||
'name' => 'At',
|
||||
'surname' => 'Familiýa',
|
||||
'mobile' => 'Telefon belgiňiz',
|
||||
],
|
||||
|
||||
];
|
||||
|
|
|
|||
|
|
@ -370,6 +370,10 @@ class SmallContactForm extends ComponentBase
|
|||
$this->validationMessages = $validator->messages();
|
||||
$this->setPostData($validator->messages());
|
||||
|
||||
if(empty($this->post['gapja']) or $this->post['gapja'] != 'anti-spam'){
|
||||
$errors[] ='Gapja must be filled with valid data';
|
||||
}
|
||||
|
||||
if($validator->failed() or count($errors)){
|
||||
|
||||
// Form main error msg (can be overriden by component property)
|
||||
|
|
|
|||
|
|
@ -4,33 +4,47 @@
|
|||
|
||||
{% else %}
|
||||
|
||||
{{ form_open(__SELF__.getFormAttributes) }}
|
||||
<section class="contact">
|
||||
<div class="auto_container">
|
||||
<div class="contact_wrap">
|
||||
<div class="contact_body">
|
||||
<div class="contact_content" id="form-steps">
|
||||
<div class="contact_title">{{'page.contact_us'|_}}</div>
|
||||
|
||||
{{ form_open(__SELF__.getFormAttributes) }}
|
||||
|
||||
{% for field in __SELF__.fields %}
|
||||
{% for field in __SELF__.fields %}
|
||||
|
||||
{{ __SELF__.getFieldHtmlCode(field)|raw }}
|
||||
{{ __SELF__.getFieldHtmlCode(field)|raw }}
|
||||
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
{{ __SELF__.getAntispamFieldHtmlCode({})|raw }}
|
||||
{{ __SELF__.getAntispamFieldHtmlCode({})|raw }}
|
||||
|
||||
{{ __SELF__.getDescriptionFieldHtmlCode({})|raw }}
|
||||
|
||||
{{ __SELF__.getRedirectFieldHtmlCode({})|raw }}
|
||||
{{ __SELF__.getDescriptionFieldHtmlCode({})|raw }}
|
||||
|
||||
{{ __SELF__.getRedirectFieldHtmlCode({})|raw }}
|
||||
|
||||
{% if (settingsGet('google_recaptcha_version') is null or settingsGet('google_recaptcha_version') == 'v2checkbox') and settingsGet('add_google_recaptcha') and settingsGet('google_recaptcha_site_key') %}
|
||||
{% if (settingsGet('google_recaptcha_version') is null or settingsGet('google_recaptcha_version') == 'v2checkbox') and settingsGet('add_google_recaptcha') and settingsGet('google_recaptcha_site_key') %}
|
||||
|
||||
<div class="{{__SELF__.getReCaptchaWrapperClass()}}">
|
||||
<div class="{{__SELF__.getReCaptchaWrapperClass()}}">
|
||||
|
||||
<div class="g-recaptcha" data-sitekey="{{ settingsGet('google_recaptcha_site_key') }}"></div>
|
||||
<div class="g-recaptcha" data-sitekey="{{ settingsGet('google_recaptcha_site_key') }}"></div>
|
||||
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{{ __SELF__.getSubmitButtonHtmlCode({})|raw }}
|
||||
|
||||
{{ form_close() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{{ __SELF__.getSubmitButtonHtmlCode({})|raw }}
|
||||
|
||||
{{ form_close() }}
|
||||
|
||||
|
||||
{% if settingsGet('add_google_recaptcha') and settingsGet('google_recaptcha_scripts_allow') %}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php namespace Tps\Birzha\Components;
|
||||
|
||||
use Cms\Classes\ComponentBase;
|
||||
use TPS\Birzha\Models\Contactmessage;
|
||||
|
||||
class ContactForm extends ComponentBase
|
||||
{
|
||||
|
|
@ -15,11 +16,11 @@ class ContactForm extends ComponentBase
|
|||
$data = post();
|
||||
|
||||
$rules = [
|
||||
'firstname' => 'required|max:100',
|
||||
'lastname' => 'required|max:100',
|
||||
'name' => 'required|max:100',
|
||||
'surname' => 'required|max:100',
|
||||
'mobile' => 'required|max:12',
|
||||
'email' => 'required|email|max:100',
|
||||
'message' => 'required'
|
||||
'content' => 'required'
|
||||
];
|
||||
|
||||
$validator = \Validator::make($data, $rules);
|
||||
|
|
@ -27,16 +28,23 @@ class ContactForm extends ComponentBase
|
|||
if($validator->fails()) {
|
||||
throw new \ValidationException($validator);
|
||||
} else {
|
||||
|
||||
// todo save message
|
||||
|
||||
$contactMessage = new Contactmessage();
|
||||
$contactMessage->fill($data);
|
||||
$contactMessage->save();
|
||||
|
||||
$vars = [
|
||||
'firstname' => \Input::get('firstname'),
|
||||
'lastname' => \Input::get('lastname'),
|
||||
'firstname' => \Input::get('name'),
|
||||
'lastname' => \Input::get('surname'),
|
||||
'mobile' => \Input::get('mobile'),
|
||||
'email' => \Input::get('email'),
|
||||
'content' => \Input::get('message')
|
||||
];
|
||||
|
||||
\Mail::send('tps.birzha::mail.message', $vars, function($message) {
|
||||
$message->to('XXXXXXXXXXXXXX', 'Birzha Admin');
|
||||
$message->to(env('TPS_EMAIL_GETTER'), 'Birzha Admin');
|
||||
$message->subject('Birzha web site contact form');
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@
|
|||
<form action="#" data-request="onSend" data-request-validate data-request-flash class="contact_form">
|
||||
<div class="contact_input">
|
||||
<label for="name">{{'page.your_firstname'|_}}</label>
|
||||
<input type="text" id="name" name="firstname" placeholder="{{'page.example'|_}}: {{'page.example_firstname'|_}}" required>
|
||||
<span class=" " data-validate-for="firstname" style="color: red;"></span>
|
||||
<input type="text" id="name" name="name" placeholder="{{'page.example'|_}}: {{'page.example_firstname'|_}}" required>
|
||||
<span class=" " data-validate-for="name" style="color: red;"></span>
|
||||
</div>
|
||||
<div class="contact_input">
|
||||
<label for="surname">{{'page.your_lastname'|_}}</label>
|
||||
<input type="text" id="surname" name="lastname" placeholder="{{'page.example'|_}}: {{'page.example_lastname'|_}}" required>
|
||||
<span class=" " data-validate-for="lastname" style="color: red;"></span>
|
||||
<input type="text" id="surname" name="surname" placeholder="{{'page.example'|_}}: {{'page.example_lastname'|_}}" required>
|
||||
<span class=" " data-validate-for="surname" style="color: red;"></span>
|
||||
</div>
|
||||
<div class="contact_input">
|
||||
<label for="mobile">{{'auth.phone'|_}}</label>
|
||||
|
|
@ -33,8 +33,8 @@
|
|||
</div>
|
||||
<div class="contact_comment">
|
||||
<label for="comment">{{'page.message'|_}}</label>
|
||||
<textarea id="message" name="message" placeholder="{{'page.describe_your_problem'|_}}" required></textarea>
|
||||
<span class=" " data-validate-for="message" style="color: red;"></span>
|
||||
<textarea id="message" name="content" placeholder="{{'page.describe_your_problem'|_}}" required></textarea>
|
||||
<span class=" " data-validate-for="content" style="color: red;"></span>
|
||||
</div>
|
||||
<button type="submit" class="btn btn--blue" data-attach-loading>
|
||||
{{'account.send'|_}}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
<?php namespace TPS\Birzha\Controllers;
|
||||
|
||||
use Backend\Classes\Controller;
|
||||
use BackendMenu;
|
||||
|
||||
class Messagescontact extends Controller
|
||||
{
|
||||
public $implement = [ 'Backend\Behaviors\ListController', 'Backend\Behaviors\FormController', 'Backend\Behaviors\ReorderController' ];
|
||||
|
||||
public $listConfig = 'config_list.yaml';
|
||||
public $formConfig = 'config_form.yaml';
|
||||
public $reorderConfig = 'config_reorder.yaml';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
BackendMenu::setContext('TPS.Birzha', 'contact-messages');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<div data-control="toolbar">
|
||||
<a href="<?= Backend::url('tps/birzha/contactmessages/reorder') ?>" class="btn btn-default oc-icon-list"><?= e(trans('backend::lang.reorder.default_title')) ?></a>
|
||||
<button
|
||||
class="btn btn-default oc-icon-trash-o"
|
||||
disabled="disabled"
|
||||
onclick="$(this).data('request-data', {
|
||||
checked: $('.control-list').listWidget('getChecked')
|
||||
})"
|
||||
data-request="onDelete"
|
||||
data-request-confirm="<?= e(trans('backend::lang.list.delete_selected_confirm')) ?>"
|
||||
data-trigger-action="enable"
|
||||
data-trigger=".control-list input[type=checkbox]"
|
||||
data-trigger-condition="checked"
|
||||
data-request-success="$(this).prop('disabled', true)"
|
||||
data-stripe-load-indicator>
|
||||
<?= e(trans('backend::lang.list.delete_selected')) ?>
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<div data-control="toolbar">
|
||||
<a href="<?= Backend::url('tps/birzha/contactmessages') ?>" class="btn btn-primary oc-icon-caret-left"><?= e(trans('backend::lang.form.return_to_list')) ?></a>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
list: $/tps/birzha/models/contactmessage/columns.yaml
|
||||
modelClass: TPS\Birzha\Models\Contactmessage
|
||||
title: Contactmessages
|
||||
noRecordsMessage: 'backend::lang.list.no_records'
|
||||
showSetup: true
|
||||
showCheckboxes: true
|
||||
recordsPerPage: 20
|
||||
toolbar:
|
||||
buttons: list_toolbar
|
||||
search:
|
||||
prompt: 'backend::lang.list.search_prompt'
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
title: Contactmessages
|
||||
modelClass: TPS\Birzha\Models\Contactmessage
|
||||
toolbar:
|
||||
buttons: reorder_toolbar
|
||||
|
|
@ -0,0 +1 @@
|
|||
<?= $this->listRender() ?>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?php Block::put('breadcrumb') ?>
|
||||
<ul>
|
||||
<li><a href="<?= Backend::url('tps/birzha/contactmessages') ?>">Contactmessages</a></li>
|
||||
<li><?= e($this->pageTitle) ?></li>
|
||||
</ul>
|
||||
<?php Block::endPut() ?>
|
||||
|
||||
<?= $this->reorderRender() ?>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<div data-control="toolbar">
|
||||
<!-- <a href="<?= Backend::url('tps/birzha/messagescontact/create') ?>" class="btn btn-primary oc-icon-plus"><?= e(trans('backend::lang.form.create')) ?></a> -->
|
||||
<a href="<?= Backend::url('tps/birzha/messagescontact/reorder') ?>" class="btn btn-default oc-icon-list"><?= e(trans('backend::lang.reorder.default_title')) ?></a>
|
||||
<button
|
||||
class="btn btn-default oc-icon-trash-o"
|
||||
disabled="disabled"
|
||||
onclick="$(this).data('request-data', {
|
||||
checked: $('.control-list').listWidget('getChecked')
|
||||
})"
|
||||
data-request="onDelete"
|
||||
data-request-confirm="<?= e(trans('backend::lang.list.delete_selected_confirm')) ?>"
|
||||
data-trigger-action="enable"
|
||||
data-trigger=".control-list input[type=checkbox]"
|
||||
data-trigger-condition="checked"
|
||||
data-request-success="$(this).prop('disabled', true)"
|
||||
data-stripe-load-indicator>
|
||||
<?= e(trans('backend::lang.list.delete_selected')) ?>
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<div data-control="toolbar">
|
||||
<a href="<?= Backend::url('tps/birzha/messagescontact') ?>" class="btn btn-primary oc-icon-caret-left"><?= e(trans('backend::lang.form.return_to_list')) ?></a>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
name: Messagescontact
|
||||
form: $/tps/birzha/models/contactmessage/fields.yaml
|
||||
modelClass: TPS\Birzha\Models\Contactmessage
|
||||
defaultRedirect: tps/birzha/messagescontact
|
||||
create:
|
||||
redirect: 'tps/birzha/messagescontact/update/:id'
|
||||
redirectClose: tps/birzha/messagescontact
|
||||
update:
|
||||
redirect: tps/birzha/messagescontact
|
||||
redirectClose: tps/birzha/messagescontact
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
list: $/tps/birzha/models/contactmessage/columns.yaml
|
||||
modelClass: TPS\Birzha\Models\Contactmessage
|
||||
title: Messagescontact
|
||||
noRecordsMessage: 'backend::lang.list.no_records'
|
||||
showSetup: true
|
||||
showCheckboxes: true
|
||||
recordsPerPage: 20
|
||||
toolbar:
|
||||
buttons: list_toolbar
|
||||
search:
|
||||
prompt: 'backend::lang.list.search_prompt'
|
||||
recordUrl: 'tps/birzha/messagescontact/update/:id'
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
title: Messagescontact
|
||||
modelClass: TPS\Birzha\Models\Contactmessage
|
||||
toolbar:
|
||||
buttons: reorder_toolbar
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
<?php Block::put('breadcrumb') ?>
|
||||
<ul>
|
||||
<li><a href="<?= Backend::url('tps/birzha/messagescontact') ?>">Messagescontact</a></li>
|
||||
<li><?= e($this->pageTitle) ?></li>
|
||||
</ul>
|
||||
<?php Block::endPut() ?>
|
||||
|
||||
<?php if (!$this->fatalError): ?>
|
||||
|
||||
<?= Form::open(['class' => 'layout']) ?>
|
||||
|
||||
<div class="layout-row">
|
||||
<?= $this->formRender() ?>
|
||||
</div>
|
||||
|
||||
<div class="form-buttons">
|
||||
<div class="loading-indicator-container">
|
||||
<button
|
||||
type="submit"
|
||||
data-request="onSave"
|
||||
data-hotkey="ctrl+s, cmd+s"
|
||||
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
|
||||
class="btn btn-primary">
|
||||
<?= e(trans('backend::lang.form.create')) ?>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
data-request="onSave"
|
||||
data-request-data="close:1"
|
||||
data-hotkey="ctrl+enter, cmd+enter"
|
||||
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
|
||||
class="btn btn-default">
|
||||
<?= e(trans('backend::lang.form.create_and_close')) ?>
|
||||
</button>
|
||||
<span class="btn-text">
|
||||
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('tps/birzha/messagescontact') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?= Form::close() ?>
|
||||
|
||||
<?php else: ?>
|
||||
<p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
|
||||
<p><a href="<?= Backend::url('tps/birzha/messagescontact') ?>" class="btn btn-default"><?= e(trans('backend::lang.form.return_to_list')) ?></a></p>
|
||||
<?php endif ?>
|
||||
|
|
@ -0,0 +1 @@
|
|||
<?= $this->listRender() ?>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?php Block::put('breadcrumb') ?>
|
||||
<ul>
|
||||
<li><a href="<?= Backend::url('tps/birzha/messagescontact') ?>">Messagescontact</a></li>
|
||||
<li><?= e($this->pageTitle) ?></li>
|
||||
</ul>
|
||||
<?php Block::endPut() ?>
|
||||
|
||||
<?php if (!$this->fatalError): ?>
|
||||
|
||||
<div class="form-preview">
|
||||
<?= $this->formRenderPreview() ?>
|
||||
</div>
|
||||
|
||||
<?php else: ?>
|
||||
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
|
||||
<?php endif ?>
|
||||
|
||||
<p>
|
||||
<a href="<?= Backend::url('tps/birzha/messagescontact') ?>" class="btn btn-default oc-icon-chevron-left">
|
||||
<?= e(trans('backend::lang.form.return_to_list')) ?>
|
||||
</a>
|
||||
</p>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?php Block::put('breadcrumb') ?>
|
||||
<ul>
|
||||
<li><a href="<?= Backend::url('tps/birzha/messagescontact') ?>">Messagescontact</a></li>
|
||||
<li><?= e($this->pageTitle) ?></li>
|
||||
</ul>
|
||||
<?php Block::endPut() ?>
|
||||
|
||||
<?= $this->reorderRender() ?>
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
<?php Block::put('breadcrumb') ?>
|
||||
<ul>
|
||||
<li><a href="<?= Backend::url('tps/birzha/messagescontact') ?>">Messagescontact</a></li>
|
||||
<li><?= e($this->pageTitle) ?></li>
|
||||
</ul>
|
||||
<?php Block::endPut() ?>
|
||||
|
||||
<?php if (!$this->fatalError): ?>
|
||||
|
||||
<?= Form::open(['class' => 'layout']) ?>
|
||||
|
||||
<div class="layout-row">
|
||||
<?= $this->formRender() ?>
|
||||
</div>
|
||||
|
||||
<div class="form-buttons">
|
||||
<div class="loading-indicator-container">
|
||||
<button
|
||||
type="submit"
|
||||
data-request="onSave"
|
||||
data-request-data="redirect:0"
|
||||
data-hotkey="ctrl+s, cmd+s"
|
||||
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
|
||||
class="btn btn-primary">
|
||||
<?= e(trans('backend::lang.form.save')) ?>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
data-request="onSave"
|
||||
data-request-data="close:1"
|
||||
data-hotkey="ctrl+enter, cmd+enter"
|
||||
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
|
||||
class="btn btn-default">
|
||||
<?= e(trans('backend::lang.form.save_and_close')) ?>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="oc-icon-trash-o btn-icon danger pull-right"
|
||||
data-request="onDelete"
|
||||
data-load-indicator="<?= e(trans('backend::lang.form.deleting')) ?>"
|
||||
data-request-confirm="<?= e(trans('backend::lang.form.confirm_delete')) ?>">
|
||||
</button>
|
||||
|
||||
<span class="btn-text">
|
||||
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('tps/birzha/messagescontact') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<?= Form::close() ?>
|
||||
|
||||
<?php else: ?>
|
||||
<p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
|
||||
<p><a href="<?= Backend::url('tps/birzha/messagescontact') ?>" class="btn btn-default"><?= e(trans('backend::lang.form.return_to_list')) ?></a></p>
|
||||
<?php endif ?>
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?php namespace TPS\Birzha\Models;
|
||||
|
||||
use Model;
|
||||
|
||||
/**
|
||||
* Model
|
||||
*/
|
||||
class Contactmessage extends Model
|
||||
{
|
||||
use \October\Rain\Database\Traits\Validation;
|
||||
|
||||
use \October\Rain\Database\Traits\SoftDelete;
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
protected $fillable = ['name', 'surname', 'email', 'mobile', 'content'];
|
||||
|
||||
|
||||
/**
|
||||
* @var string The database table used by the model.
|
||||
*/
|
||||
public $table = 'tps_birzha_contactform_messages';
|
||||
|
||||
/**
|
||||
* @var array Validation rules
|
||||
*/
|
||||
public $rules = [
|
||||
];
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
columns:
|
||||
id:
|
||||
label: ID
|
||||
type: number
|
||||
sortable: true
|
||||
name:
|
||||
label: 'First name'
|
||||
type: text
|
||||
searchable: true
|
||||
sortable: true
|
||||
surname:
|
||||
label: 'Last name'
|
||||
type: text
|
||||
searchable: true
|
||||
sortable: true
|
||||
created_at:
|
||||
label: 'Date and time'
|
||||
type: datetime
|
||||
sortable: true
|
||||
content:
|
||||
label: Message
|
||||
type: text
|
||||
searchable: true
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
fields:
|
||||
name:
|
||||
label: 'First name'
|
||||
span: auto
|
||||
readOnly: 1
|
||||
type: text
|
||||
surname:
|
||||
label: 'Last name'
|
||||
span: auto
|
||||
readOnly: 1
|
||||
type: text
|
||||
email:
|
||||
label: Email
|
||||
span: auto
|
||||
readOnly: 1
|
||||
type: text
|
||||
mobile:
|
||||
label: Mobile
|
||||
span: auto
|
||||
readOnly: 1
|
||||
type: text
|
||||
content:
|
||||
label: Message
|
||||
size: ''
|
||||
span: auto
|
||||
readOnly: 1
|
||||
type: textarea
|
||||
|
|
@ -81,6 +81,10 @@ navigation:
|
|||
icon: icon-flag
|
||||
permissions:
|
||||
- currency
|
||||
contact-messages:
|
||||
label: 'Contact form'
|
||||
url: tps/birzha/messagescontact
|
||||
icon: icon-inbox
|
||||
permissions:
|
||||
category:
|
||||
tab: Catalog
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
<?php namespace TPS\Birzha\Updates;
|
||||
|
||||
use Schema;
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
class BuilderTableCreateTpsBirzhaContactformMessages extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('tps_birzha_contactform_messages', function($table)
|
||||
{
|
||||
$table->engine = 'InnoDB';
|
||||
$table->increments('id')->unsigned();
|
||||
$table->string('name');
|
||||
$table->string('surname');
|
||||
$table->string('email');
|
||||
$table->string('mobile');
|
||||
$table->text('content');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('tps_birzha_contactform_messages');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?php namespace TPS\Birzha\Updates;
|
||||
|
||||
use Schema;
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
class BuilderTableUpdateTpsBirzhaContactformMessages extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('tps_birzha_contactform_messages', function($table)
|
||||
{
|
||||
$table->timestamp('created_at')->nullable();
|
||||
$table->timestamp('updated_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('tps_birzha_contactform_messages', function($table)
|
||||
{
|
||||
$table->dropColumn('created_at');
|
||||
$table->dropColumn('updated_at');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?php namespace TPS\Birzha\Updates;
|
||||
|
||||
use Schema;
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
class BuilderTableUpdateTpsBirzhaContactformMessages2 extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('tps_birzha_contactform_messages', function($table)
|
||||
{
|
||||
$table->timestamp('deleted_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('tps_birzha_contactform_messages', function($table)
|
||||
{
|
||||
$table->dropColumn('deleted_at');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -242,3 +242,12 @@
|
|||
1.0.84:
|
||||
- 'Updated decimal table tps_birzha_transactions'
|
||||
- builder_table_update_tps_birzha_transactions_3.php
|
||||
1.0.85:
|
||||
- 'Created table tps_birzha_contactform_messages'
|
||||
- builder_table_create_tps_birzha_contactform_messages.php
|
||||
1.0.86:
|
||||
- 'Updated table tps_birzha_contactform_messages'
|
||||
- builder_table_update_tps_birzha_contactform_messages.php
|
||||
1.0.87:
|
||||
- 'Updated table tps_birzha_contactform_messages'
|
||||
- builder_table_update_tps_birzha_contactform_messages_2.php
|
||||
|
|
|
|||
Loading…
Reference in New Issue