PHP code example of unnathianalytics / laraform

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

    

unnathianalytics / laraform example snippets


use LaraForm\Form;
use LaraForm\Fields\{TextField, DateField, MoneyField, SearchSelectField, ToggleField};

$form = Form::make()
    ->action(route('invoices.store'))
    ->fields([
        TextField::make('party')->label('Party name')->upper()->sUrl('/api/customers'),
        ToggleField::make('active')->label('Active')->default(true),
    ])
    ->submit('Save');

'classes' => [
    'control' => 'rounded border-gray-300 focus:ring-2 focus:ring-emerald-500',
    'label'   => 'text-sm font-medium text-gray-700',
    'popup'   => 'rounded-md border bg-white shadow-lg',
],

TextField::make('shortcode')->minLength(2)->maxLength(8),
MoneyField::make('room_rate')->icit date_format:Y-m-d
SelectField::make('type')->options($types),   // implicit in:options
TextField::make('slug')->rules('alpha_dash|unique:resorts'),   // any Laravel rule

$data = $form->validate($request, [
    'city' => [Rule::in($cities)],    // app-specific extras, appended per key
]);

use LaraForm\Panel;

TextField::make('item')->label('Item')->opensPanel(
    Panel::make('item-desc')
        ->title('Item description')
        ->fields([
            TextField::make('desc1')->label('Description 1'),
            TextField::make('desc2')->label('Description 2'),
        ])
        ->doneLabel('Done')                          // default 'Done'
        ->hint('Enter to move down · Esc to close')  // default; '' hides it
        ->width('28rem'),
),

Panel::make('items')
    ->title('Items')
    ->width('72rem')
    ->fields([YesNoField::make('taxable')->label('Taxable?')])  // Field | Htmlable | string
    ->slot(new HtmlString('<hr>'))                // raw content (plain strings are escaped)
    ->view('vouchers.item-grid', ['voucher' => $id])            // any blade partial
    ->livewire('item-grid', ['voucher' => $id]),  // sugar — 
blade
<form method="POST" action="..." data-lf-form data-lf-enter="1" data-lf-enter-last="submit" novalidate>
    @csrf
    {!! \LaraForm\Fields\DateField::make('from_date')->label('From') !!}
</form>