定制 mashfiqdev/form_maker 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

mashfiqdev/form_maker

Composer 安装命令:

composer require mashfiqdev/form_maker

包简介

This package helps you to make your desired form. You can pass values, types, id, styles to the helpers.

README 文档

README

Form maker for Laravel inspired by Laravel form builder. With the help of Form Maker views, forms can be modified and reused easily. You can pass style, values, types to the helpers.

Features

  • Style - Pass style to the helper to customize element
  • Value - Pass value to the helper to get the data from the particular field
  • Type - Set the type of the input field such as email, number, tel etc.
  • Active - Active the desired radio button or select field.
  • Required - Handle the required field of the form

Requirements

Quick Installation

Via Composer

$ composer require mashfiqdev/form_maker

For Laravel version < 5.5

If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php

\MashfiqDev\FormMaker\FormMakerServiceProvider::class,

Usage

You can use this in your blade file to make your form.

For Input Element

You have to store the style containing classes, value, type, id, name in a variable like this:

$emaildata = [
    "ids" => ["email"],
    "classes" => ["form-control", "bg-light","my-2"],
    "type" => "email",
    "name" => "email",
    "values" => [
        "prev_value" => "mashfiqurrr@gmail.com"
    ],
    "required" => true
];

And include the HTML input element like this:

<div class="form-group">
    <label for="name">Email</label>
    @include('FormElement::input', ['data' => $emaildata])
</div>

For Select Element

You have to store the style containing classes, value, id, name, active field, required status in a variable like this:

$countrydata = [
    "ids" => ["country"],
    "classes" => ["form-select", "bg-light","my-2"],
    "name" => "country",
    "values" => [
        "BD" => "Bangladesh",
        "AUS" => "Australia",
        "DU" => "Germany",
        "CN" => "Canada",       
    ],
    "active" => "DU",
    "required" => true
];

And include the HTML input element like this:

<div class="form-group">
    <label for="country">Country</label>
    @include('FormElement::select', ['data' => $countrydata])
</div>

For Checkbox Element

You have to store the style containing classes, value, id, name, active field, required status in a variable like this:

$degreedata = [
    "ids" => ["degree"],
    "classes" => ["py-2", "bg-light","my-2","blockquote"],
    "name" => "degree",
    "values" => [
        "psc" => "P.S.C",
        "jsc" => "J.S.C",
        "ssc" => "S.S.C",
        "hsc" => "H.S.C",
        "bsc" => "B.S.C",
        "msc" => "M.S.C", 
    ],
    "required" => true
];

And include the HTML input element like this:

<div class="form-group">
    <label for="country">Degree</label>
    @include('FormElement::checkbox', ['data' => $degreedata])
</div>

For Radio Element

You have to store the style containing classes, value, id, name, active field, required status in a variable like this:

$maritaldata = [
    "ids" => ["marital"],
    "classes" => ["form-check","form-check-inline", "bg-light","my-2","blockquote"],
    "name" => "marital",
    "values" => [
        "single" => "Single",
        "married" => "Married",
        "unmarried" => "Unmarried"
        ],
    "active" => "unmarried",
    "required" => true
];

And include the HTML input element like this:

<div class="form-group">
    <label for="country">Marital Status</label><br>
    @include('FormElement::radio', ['data' => $maritaldata])
</div>

So, Your final form could be like this:

<div class="container py-5 mt-5 card col-md-6 offset-3">
        <h1 class="text-center">Sign Up</h1>
        <form>
            <div class="form-group">
                <label for="name">Email</label>
                @include('FormElement::input', ['data' => $emaildata])
            </div>
            <div class="form-group">
                <label for="country">Country</label>
                @include('FormElement::select', ['data' => $countrydata])
            </div>
            <div class="form-group">
                <label for="country">Degree</label>
                @include('FormElement::checkbox', ['data' => $degreedata])
            </div>
            <div class="form-group">
                <label for="country">Marital Status</label><br>
                @include('FormElement::radio', ['data' => $maritaldata])
            </div>
            


            <button type="submit" class="btn btn-primary" disabled>Submit</button>
        </form>
</div>

Security

If you discover any security related issues, please email mashfiqurrr@gmail.com instead of using the issue tracker.

Author

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-04-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固