定制 adereksisusanto/laravel-generator 二次开发

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

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

adereksisusanto/laravel-generator

Composer 安装命令:

composer require adereksisusanto/laravel-generator

包简介

Generate Laravel models, migrations, and seeders from existing database tables

README 文档

README

PHP Laravel License Tests PHPStan 1.x Downloads

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
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固