peterzaccha/dy-form
Composer 安装命令:
composer require peterzaccha/dy-form
包简介
Dynamic Form Generator
README 文档
README
Installation
You can install the package via composer:
composer require peterzaccha/dy-form
If you are using Laravel in a version < 5.5, the service provider must be registered as a next step:
// config/app.php 'providers' => [ ... Peterzaccha\DyForm\DyFormServiceProvider::class ];
You can publish the views ,migrations and config by running :
php artisan vendor:publish --provider="Peterzaccha\DyForm\DyFormServiceProvider"
php artisan migrate
Warning
⚠️ This documentation ins INCOMPLETE! Please use on your own, or wait until it's ready! ⚠️
Usage
Creating Forms
$form = Dy::create(['name'=>'myForm']);
Creating Columns
$column = Dy::createColumn(['name'=>'myColumn','label'=>'My Column','render_type'=>'text']);
Add columns to the form
Dy::addColumn($form,$column);
Add options to column
Dy::addOption($column,Dy::createOption(['name'=>'one','value'=>'1']));
Submit form
Dy::submit($user, \Peterzaccha\DyForm\Models\DyForm::find(1),[ 'columnName' => 'column value', ]); //or from request Dy::submit($user, \Peterzaccha\DyForm\Models\DyForm::find(1),$request->all());
Using CanSubmit trait
<?php namespace App; use Peterzaccha\DyForm\Traits\CanSubmit; class User extends Authenticatable { use CanSubmit; }
Now you can do
use Peterzaccha\DyForm\Models\DyColumn; $column = DyColumn::find(1); $user->getColumnValue($column); //return the user submitted value in that column
use Peterzaccha\DyForm\Models\DyForm; $form = DyForm::find(1); $user->getFormValues($form); //return [ 'colum1'=>'value1' , 'column2'=>'value2' ]
Render Types
- checkbox
- color
- date
- file
- month
- multipleFile
- number
- password
- push (soon)
- radioButton
- range
- select
- selectMultiple
- textarea
- time
- url
- week
Render
You can use the component dy-form
<dy-form :id="$formId" :user="$userModelObject"> <input type="submit"> </dy-form>
Changelog
Check CHANGELOG for the changelog
Testing
To run tests use
$ composer test
Contributing
Security
If you discover any security related issues, please email p.pator@outlook.com or use the issue tracker of GitHub.
About
License
The MIT License (MIT). Please see License File for more information.
peterzaccha/dy-form 适用场景与选型建议
peterzaccha/dy-form 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 71 次下载、GitHub Stars 达 2, 最近一次更新时间为 2019 年 07 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 peterzaccha/dy-form 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 peterzaccha/dy-form 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 71
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-07-14