syahmi-jalil/database-to-model 问题修复 & 功能扩展

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

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

syahmi-jalil/database-to-model

最新稳定版本:v1.1.0

Composer 安装命令:

composer require syahmi-jalil/database-to-model

包简介

Laravel package to generate models and migrations from existing database structure

README 文档

README

A Laravel package to generate models and migrations from existing database structure. This package allows you to reverse engineer your database into Laravel models and migrations, making it easier to work with existing databases or to create a backup of your database structure.

Installation

You can install the package via composer:

composer require syahmi-jalil/database-to-model

The package will automatically register its service provider.

Configuration

Publish the configuration file:

php artisan vendor:publish --tag=database-to-model-config

This will create a config/database-to-model.php file where you can configure:

  • Tables to ignore when generating models and migrations
  • Default paths for generated files
  • Maximum number of columns per migration file

Usage

Generate models and migrations for all tables:

php artisan generate:models-migrations

Available Options

  • --tables: Specific tables to generate (comma-separated)
  • --connection: Database connection to use (defaults to your default connection)

Examples

Generate for specific tables:

php artisan generate:models-migrations --tables=users,products,orders

Use a different database connection:

php artisan generate:models-migrations --connection=mysql

Features

  • Automatically generates models with proper relationships
  • Creates migrations that match your existing database structure
  • Handles foreign key constraints properly
  • Sorts tables by dependencies to ensure proper migration order
  • Customizable through configuration

Requirements

  • PHP ^8.0
  • Laravel ^9.0|^10.0|^11.0

Author

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-28