承接 gustiawan/laravel-form-builder 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

gustiawan/laravel-form-builder

Composer 安装命令:

composer require gustiawan/laravel-form-builder

包简介

Laravel Form Builder

README 文档

README

Installation

composer require gustiawan/laravel-form-builder

run this command to publish package

php artisan vendor:publish --provider="Gustiawan\FormBuilder\FormBuilderServiceProvider"

configuration

change style to bootstrap if you want to use bootstrap styling

    /**
     * Set your default styling 
     * the option is [tailwind, bootstrap]
     */
    "style" => "tailwind",

change this only if you want to use custom form template

    /**
     * Fill this with your view path
     */
    "form_template" => null

Usage

create form using

php artisan make:form {name}

the file is written in App/Form

add your form depends on your need

use Gustiawan\FormBuilder\Form;

class ExampleForm extends Form
{
    public function handle() 
    {
        $this->text("textinput", "Text Input");
        $this->password("password", "Old Password");
        $this->textArea("text area", "Text Area", "Default Value");
        $this->date("example_date", "Example Date");
        $this->radio("radio_example", "Radio Example", [1 => "Option one", 2 => "Option two"], ["value" => 1]); // default value
        $this->checkBox("checkbox_example", "Checkbox Example", [1 => "Option one", 2 => "Option two"], ["value" => [1, 2]]); // default value must be array
        $this->select("select_field", "Select Field Example", [1 => "Option one", 2 => "Option two"], ["value" => 1]); // default value
    }
}

then inside your controller

public function example() 
{
    $form = new ExampleForm([
        "action" => route('example_routes'),
        "method" => "POST",
        // optional
        "data" => [
            "field_name" => "some value"
        ]
    ]);

    return view('example_view', compact('form'));
}

in your view

<x-form-generator-form :form="$form" />

field options

to add default value to the field

$this->text("textinput", "Text Input", ["value" => "some value"]);

to make field is required field

$this->text("textinput", "Text Input", ["required" => true]);

to make field readonly

$this->text("textinput", "Text Input", ["readonly" => true]);

to make field disabled

$this->text("textinput", "Text Input", ["disabled" => true]);

to add custom class to the inputs

$this->text("textinput", "Text Input", ["class" => "datetimepicker"]);

统计信息

  • 总下载量: 2.51k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2021-02-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固