定制 aluisio-pires/laravel-dynamic-forms 二次开发

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

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

aluisio-pires/laravel-dynamic-forms

最新稳定版本:v0.0.1

Composer 安装命令:

composer require aluisio-pires/laravel-dynamic-forms

包简介

Dynamic Forms for Laravel with validations.

README 文档

README

LaravelDynamicForms

Dynamic Forms for Laravel with validations.

Requirements

  • Laravel 9+

Install

   composer require aluisio-pires/laravel-dynamic-forms

Register the provider class in "config/app.php"

   'providers' => [
    // Others ServiceProviders

    AluisioPires\LaravelDynamicForms\LaravelDynamicFormsServiceProvider::class,
],

Run the install command

   php artisan dynamic-forms:install

Usage

In your model class, use HasForms trait. Example:

<?php

 namespace App\Models;
 
 use App\Traits\HasForms;
 use Illuminate\Database\Eloquent\Factories\HasFactory;
 use Illuminate\Database\Eloquent\Model;
 
 class MyModel extends Model
 {
     use HasForms;
     use HasFactory;
     
     protected $fillable = [
         'form_id',
     ];
 }

Now you can create your own form with fields and validations. You can see the model field contents just like:

$model->fieldName

You also can save the content just passing field names, like:

$model->saveFields([
         'fieldName1' => [
             123,
             123,
         ],
         'fieldName2' => 'test',
     ]);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-06