从 Laravel 5 上的现有数据库开始

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30416388/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 11:37:19  来源:igfitidea点击:

Starting with existing database on Laravel 5

phplaravelormeloquent

提问by Santosh Achari

I have been enjoying working on Laravelfor a while now, and am planning to move a fairly large project to Laravel 5.

我一直很喜欢在Laravel 上工作一段时间,并计划将一个相当大的项目转移到 Laravel 5。

The new project has fairly large database with numerous tables, and it would take considerable amount of time build migrations, models and controllers individually.

新项目有相当大的数据库,有很多表,单独构建迁移、模型和控制器需要大量时间。

Has anybody worked on this before? What is the best way to go about it?

以前有人做过这方面的工作吗?最好的方法是什么?

I have used this great extensionto generate migrations as of now - but still for a 200+ tables, it would take quite a long time to do the rest.

到目前为止,我已经使用这个很棒的扩展来生成迁移 - 但对于 200 多个表,仍然需要很长时间来完成其余的工作。

回答by Varsha Prabhakar

Try this one: https://github.com/reliese/laravel

试试这个:https: //github.com/reliese/laravel

Reliese Laravel is a collection of Laravel Components which aim is to help the development process of Laravel applications by providing some convenient code-generation capabilities.

Reliese Laravel 是 Laravel 组件的集合,旨在通过提供一些方便的代码生成功能来帮助 Laravel 应用程序的开发过程。

回答by Bonn

How about this: http://packalyst.com/packages/package/ignasbernotas/laravel-model-generator

这个怎么样:http: //packalyst.com/packages/package/ignasbernotas/laravel-model-generator

Model generator Laravel 5 model generator for an existing schema.

It plugs into your existing database and generates model class files based on the existing tables.

模型生成器 Laravel 5 现有模式的模型生成器。

它插入您现有的数据库并根据现有表生成模型类文件。

回答by Bogdan

For migrating models and controllers just use artisancommands, you can't get around it any easier than that. For the migrations I can suggest trying to use the following package:

对于迁移模型和控制器,只需使用artisan命令,您就不会比这更容易了。对于迁移,我建议尝试使用以下软件包:

Laravel Database Exporter

Laravel 数据库导出器

It will export your existing DB schemas as Laravel migrations. My suggestion is based on the assumption that you are using MySQL as your RDBMS, because the package I suggested only works with that.

它将您现有的数据库模式导出为 Laravel 迁移。我的建议是基于你使用 MySQL 作为 RDBMS 的假设,因为我建议的包只适用于它。