PHP code example of ramonsmit / laravel-form-builder
1. Go to this page and download the library: Download ramonsmit/laravel-form-builder 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/ */
ramonsmit / laravel-form-builder example snippets
DALTCORE\LaravelFormBuilder\ServiceProvider::class,
'Formbuilder' => DALTCORE\LaravelFormBuilder\Facades\LaravelFormBuilder::class,
$form = Formbuilder::form()->create([
'name' => '', // Validations: mails' => '', // Validations: nullable|string Default: null
'success_message' => '', // Validations: nullable|string Default: null
'redirect_url' => '', // Validations: nullable|string Default: null
'confirm_email' => '', // Validations: : nullable|string Default: null
]);
$element = $form->element()->create([
'formbuilder_form_id' => '', // Validations: 'order' => '', // Validations: integer|nullable Default: null
'lp_block' => '', // Validations: string|nullable Default: null
'type' => '', // Validations:
$value = $element->value()->create([
'formbuilder_element_id' => '', // Validations: rder' => '', // Validations: integer|nullable Default: null
'name' => '', // Validations:
$array = $form->build()->toArray();
Array response example:
/**
array (
'id' => 1,
'name' => 'Test formulier',
'success_message' => NULL,
'redirect_url' => NULL,
'recaptcha' => 0,
'recaptcha_public_key' => NULL,
'elements' =>
array (
0 =>
array (
'id' => 1,
'order' => NULL,
'k' => NULL,
'type' => 'select',
'values' =>
array (
0 =>
array (
'id' => 1,
'order' => NULL,
'name' => 'Waarde 1',
),
1 =>
array (
'id' => 2,
'order' => NULL,
'name' => 'Waarde 2',
),
2 =>
array (
'id' => 3,
'order' => NULL,
'name' => 'Waarde 3',
),
3 =>
array (
'id' => 4,
'order' => NULL,
'name' => 'Waarde 4',
),
),
),
),
)
*/
$json = $form->build()->toJson();
/**
Json response example:
{
"id": 1,
"name": "Test formulier",
"success_message": null,
"redirect_url": null,
"recaptcha": 0,
"recaptcha_public_key": null,
"elements": [{
"id": 1,
"order": null,
"
$form = Formbuilder::form()-load(25);
$form->update([
'emails' => '[email protected] , [email protected] ',
'success_message' => 'Yes, you did it right!',
]);
$element = Formbuilder::element()-load(69);
$element->update([
'name' => 'Voornaam',
'placeholder' => 'John Doe',
]);
$element = Formbuilder::value()-load(12);
$element->update([
'active' => true,
]);
$form = Formbuilder::form()-load(25)->delete();
// or
$form = Formbuilder::form()->delete(25);
$element = Formbuilder::element()-load(69)->delete();
// or
$element = Formbuilder::element()->delete(25);
$value = Formbuilder::value()-load(12)->delete();
// or
$value = Formbuilder::value()->delete(12);
bash
php artisan migrate