maulik/filament-auto-crud 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

maulik/filament-auto-crud

最新稳定版本:1.0.0

Composer 安装命令:

composer require maulik/filament-auto-crud

包简介

Automatically generate Filament resources from Laravel models and database tables

README 文档

README

This Laravel package automatically generates Filament resources (CRUD panels) based on your existing models or database tables. It analyzes your database schema and model relationships to create fully functional Filament resources with minimal configuration.

Features

  • Automatically generate Filament resources from existing models
  • Detect and configure appropriate form fields based on column types
  • Handle model relationships (belongsTo, hasMany, etc.)
  • Customizable field type mappings
  • Support for common column types
  • Exclude specific tables/models from generation
  • Optional AI-powered field configuration (requires OpenAI API key)

Requirements

  • PHP 8.1 or higher
  • Laravel 10.x or 11.x
  • Filament 3.x

Installation

composer require maulik/filament-auto-crud

Configuration

Publish the configuration file:

php artisan vendor:publish --provider="Maulik\FilamentAutoCrud\FilamentAutoCrudServiceProvider"

This will create a config/filament-auto-crud.php file where you can customize:

  • Excluded tables/models Then, enable AI settings in the configuration file:
'ai' => [
    'enabled' => true,
    'model' => 'gpt-3.5-turbo',
],

Contributing

Contributions are welcome! Please submit a Pull Request.

License

This package is open-sourced software licensed under the MIT license.- Field type mappings

  • Relationship field types
  • Resource generation path
  • AI integration settings (optional)

Usage

Generate a Resource for a Single Model

php artisan filament:generate-resource User

Or with full namespace:

php artisan filament:generate-resource "App\Models\User"

Generate Resources for All Models

php artisan filament:generate-resources

Options:

  • --path: The path to look for models (default: app/Models)
  • --namespace: The namespace of the models (default: App\Models)

Customization

Field Type Mappings

You can customize how database column types map to Filament field types in the configuration file:

'field_types' => [
    'string' => 'TextInput',
    'text' => 'Textarea',
    'integer' => 'TextInput::numeric',
    'boolean' => 'Toggle',
    // ...
],

Relationship Field Types

Configure how different relationship types are rendered:

'relationship_types' => [
    'belongsTo' => 'Select',
    'hasMany' => 'Repeater',
    'belongsToMany' => 'MultiSelect',
    // ...
],

Excluding Tables/Models

Specify which tables or models should be excluded from resource generation:

'exclude' => [
    'migrations',
    'password_resets',
    'failed_jobs',
    // ...
],

AI Integration (Optional)

Enable AI-powered features by setting your OpenAI API key in your .env file:

OPENAI_API_KEY=your-api-key

Then enable AI integration in the configuration:

'ai' => [
    'enabled' => true,
    'model' => 'gpt-3.5-turbo',
],

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This package is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-19