adereksisusanto/laravel-generator
Composer 安装命令:
composer require adereksisusanto/laravel-generator
包简介
Generate Laravel models, migrations, and seeders from existing database tables
关键字:
README 文档
README
Generate Laravel models, migrations, and seeders directly from your existing database tables.
Supports MySQL, PostgreSQL, SQLite, and SQL Server. Compatible with PHP 7.2.5+ and Laravel 7–8.
Installation
composer require adereksisusanto/laravel-generator
Publish config (optional):
php artisan vendor:publish --provider="Adereksisusanto\Laravel\Generator\ServiceProvider" --tag=config
Commands
# Generate all (models + migrations + seeders) php artisan generate # Individual generators php artisan generate:model php artisan generate:migration php artisan generate:seeder
Options
# Specific tables php artisan generate:model --tables=users,posts # Custom namespace (model only) php artisan generate:model --namespace="App\Models" # Record limit (seeder only, 0 = unlimited) php artisan generate:seeder --limit=50 # Overwrite existing files php artisan generate:model --force # Custom connection php artisan generate:model --connection=mysql # Also generate migration and/or seeder with model php artisan generate:model --tables=users -m php artisan generate:model --tables=users -s php artisan generate:model --tables=users -ms
Combined command flags (generate)
| Flag | Description |
|---|---|
--model-only |
Generate only models |
--migration-only |
Generate only migrations |
--seeder-only |
Generate only seeders |
--seeder-limit |
Max seed records (0 = unlimited) |
What Gets Generated
Models
Eloquent model with $fillable, $casts, $dates, $hidden, relationships (belongsTo/hasMany), and SoftDeletes trait when deleted_at column exists.
Migrations
Schema::create() with proper column types, nullable, unsigned, defaults, and indexes.
Seeders
Model::insert([...]) populated with actual data from your database table.
Configuration
// config/generator.php 'tables' => [ 'includes' => [], 'excludes' => ['migrations', 'failed_jobs'], ], 'paths' => [ 'model' => app_path('Models'), 'migration' => database_path('migrations'), 'seeder' => database_path('seeders'), ], 'model' => [ 'timestamps' => true, 'soft_deletes' => false, 'relationships' => true, ], 'seeder' => [ 'limit' => 100, ],
Contributing
See CONTRIBUTING for contribution guidelines.
Changelog
See CHANGELOG for recent changes.
License
The MIT License (MIT). See LICENSE for more information.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-10