PHP code example of adamthehutt / laravel-lean-forms

1. Go to this page and download the library: Download adamthehutt/laravel-lean-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/ */

    

adamthehutt / laravel-lean-forms example snippets


use AdamTheHutt\LeanForms\AbstractForm;
use AdamTheHutt\LeanForms\Elements\Select;
use AdamTheHutt\LeanForms\Elements\Text;
use AdamTheHutt\LeanForms\Elements\Textarea;

class AnimalCreate extends AbstractForm
{
    public $fields = [
        'name' => Text::class,
        'description' => Textarea:class
    ];

   /**
    * This field is a bit more complex so we'll define it explicitly rather
    * than simply in $this->fields.
    */
    public function preferredDiet()
    {
        return $this->element(Select::class)
                    ->multiple()
                    ->options(['Plants', 'Bugs', 'Humans']);
    }
}

{{ $form->open()->nowrap() }}

$form = app("forms")->form("animal.create", $model);

$form = app("forms")("animal.create", $model);
bash
php artisan vendor:publish