PHP code example of vis / apply_form_l5
1. Go to this page and download the library: Download vis/apply_form_l5 library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
vis / apply_form_l5 example snippets
Vis\ApplyForm\ApplyFormServiceProvider::class,
php artisan migrate --path=vendor/vis/apply_form_l5/src/Migrations
php artisan vendor:publish --provider="Vis\ApplyForm\ApplyFormServiceProvider" --force
@
array(
'title' => 'Заявки',
'icon' => 'list',
'check' => function() {
return Sentinel::hasAccess('admin.apply_form.view');
},
'submenu' => array(
array(
'title' => "Отправленные заявки",
'check' => function() {
return Sentinel::hasAccess('admin.apply_form.view');
},
'submenu' => array(
//определение tb-definitions для форм заявок
)
),
array(
'title' => "Сообщения ответы",
'link' => '/vis_apply_form_setting_messages',
'check' => function() {
return Sentinel::hasAccess('admin.vis_apply_form_setting_messages.view');
}
),
array(
'title' => "E-mail адреса",
'link' => '/vis_apply_form_setting_emails',
'check' => function() {
return Sentinel::hasAccess('admin.vis_apply_form_setting_emails.view');
}
),
)
),
'Заявки' => array(
'admin.apply_form.view' => 'Просмотр',
'admin.apply_form.create' => 'Создание',
'admin.apply_form.update' => 'Редактирование',
'admin.apply_form.delete' => 'Удаление',
),
'Заявки - Сообщения' => array(
'admin.vis_apply_form_setting_messages.view' => 'Просмотр',
'admin.vis_apply_form_setting_messages.create' => 'Создание',
'admin.vis_apply_form_setting_messages.update' => 'Редактирование',
'admin.vis_apply_form_setting_messages.delete' => 'Удаление',
),
'Заявки - Имейлы' => array(
'admin.vis_apply_form_setting_emails.view' => 'Просмотр',
'admin.vis_apply_form_setting_emails.create' => 'Создание',
'admin.vis_apply_form_setting_emails.update' => 'Редактирование',
'admin.vis_apply_form_setting_emails.delete' => 'Удаление',
),
/**
* Defines usage of Google Invisible reCaptcha
* @link https://www.google.com/recaptcha/admin
*/
'grecaptcha' => [
'enabled' => true,
'site_key' => '',
'secret_key' => ''
],
namespace App\Models\ApplyForm;
use Vis\ApplyForm\Models\AbstractApplyForm;
class ApplyFormAuthorizedMessage extends AbstractApplyForm
{
protected $table = "apply_form_authorized_messages";
protected $validationRules = [
"personal_data" => 'llable|otected $mailTemplate = 'shablon-zajavka-avtorizirovannoe-obrashenie';
protected $mailAddressSlug = 'email-zayavka-avtorizirovannoe-obrashenie';
protected $messageSlug = 'soobshchenie-zayavka-avtorizirovannoe-obrashenie';
protected $messageFailSlug = 'soobshchenie-fail-zayavka-avtorizirovannoe-obrashenie';
protected function prepareInputData(array $inputData): array
{
$this->inputCleaner()->setArray($inputData);
$preparedData = [
'name' => $this->inputCleaner()->getCleanString('name'),
'answer_type' => $this->inputCleaner()->getString('answer_type'),
'phone' => $this->inputCleaner()->getString('phone'),
'email' => $this->inputCleaner()->getCleanString('email'),
'message' => $this->inputCleaner()->getCleanString('message'),
'file' => $this->inputCleaner()->getString('file'),
];
return $preparedData;
}
protected function prepareMailData(array $preparedData): array
{
$preparedData['answer_type'] = $preparedData['answer_type'] == 'email' ? 'Email' : 'Телефон';
$preparedData['file_url'] = asset($preparedData['file']);
return $preparedData;
}
protected function customCallback(array $attributes)
{
//print_arr($attributes);
}
}
'apply_forms' => [
'authorized_messages' => App\Models\ApplyForm\ApplyFormAuthorizedMessage::class,
],
namespace App\Models\ApplyForm;
use Vis\ApplyForm\Models\AbstractApplyForm;
class ApplyFormAuthorizedMessage extends AbstractApplyForm
{
}
protected $table = '';
protected $validationRules = [
];
protected $fileFieldName = '';
protected $fileStorageFolder = '';
protected $fileStorageFolder = '';
protected $mailTemplate = '';
protected $mailAddressSlug = '';
protected $messageSlug = '';
protected $messageFailSlug = '';
protected function prepareInputData(array $inputData): array
protected function prepareMailData(array $preparedData): array
protected function customCallback($attributes)
public function setArray(array $array)
public function getArray(): array
public function get(string $field)
public function getInt(string $field): int
public function getFloat(string $field): float
public function getString(string $field): string
public function getCleanString(string $field): string
public function getJson(string $field): string
protected function handleFile($formField, array &$row)
protected function handleForeign($formField, array &$row)
js
initPhoneMask: function () {
$('input[name=phone]').mask('+38 (000) 000-00-00', {clearIfNotMatch: true});
},