1. Go to this page and download the library: Download uspdev/forms 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/ */
uspdev / forms example snippets
$form = [
'name' => 'contact_form', // chave de acesso ao form
'group' => config('uspdev-forms.defaultGroup'), // permite agrupar vários forms
'description' => 'A form for user inquiries.',
'fields' => [
[
'name' => 'codpes',
'type' => 'pessoa-usp',
'label' => 'Pessoa (select2)',
' => 'rating',
'type' => 'select',
'label' => 'Avaliação (select)',
'options' => [
'1', '2', '3', '4', '5'
]
],
[
'name' => 'message',
'type' => 'textarea',
'label' => 'Mensagem (textarea)',
],
],
];
FormDefinition::create($form);
use Uspdev\Forms\Forms;
$form = new Form($key = null, ['action' => route('sua-rota-do-action')]);
$formHtml = $form->generateHtml('contact_form'); // conforme definido em $form
// ....
public function store(Request $request)
{
$form = (new Form())->handleSubmission($request);
// ....
}
$allSubmissions = $form->listSubmission();
// Or
$allFormNameSubmissions = $form->listSubmission('form-name');