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
其他信息
- 授权协议: MIT
- 更新时间: 2025-02-28