問題描述
我在 MySQL Workbench 中設計了我的數據庫,并設置了我所有的外鍵等
I've designed my database in MySQL Workbench, and have all my foreign keys setup, etc.
我想在 Laravel 4 中使用這個 DB 模式,但是從文檔中沒有任何文字可以使用現有的數據庫表集.根據我的理解,其他框架(例如 Cake 及其烘焙")允許您根據數據庫中已有的表自動生成模型類.
I'm wanting to use this DB schema with Laravel 4, however from the docs there is no word of any sort of ability to work with an existing set of database tables. From my understanding, other frameworks such as Cake with its 'Baking' allow you to automatically generate your model classes based on the tables already in your database.
我到處環顧四周,根本看不到 Laravel 4 的任何相關信息.我發現最接近的是 Jeffrey Way 的用于工匠的 Generator 包,但是這只創建了基本模型,并沒有檢測到已建立的模型外鍵關系.
I've looked around everywhere and cant see anything about this at all for Laravel 4. The closest thing I've found is Jeffrey Way's Generator package for artisan, however this only creates the base model, and doesn't detect established foreign key relationships.
這在 Laravel 4 中是可行的,還是我必須手動完成?
Is this even possible with Laravel 4 or am I going to have to just do it all manually?
推薦答案
好消息是 Antonio 剛剛完成了他的 MySQL WorkBench 到 Eloquent ORM 轉換器這是一個很好的解決方案,但對我來說有點晚了,但可能對你有很大幫助.
The good news is that Antonio just finished his MySQL WorkBench to Eloquent ORM converter This is a beautiful solution but comes a way to late for me but may help you a lot.
更新:該鏈接目前無效.網頁上寫著我們正在重新設計東西,很快就會回來!".我已經給 antonio 發了一封電子郵件,詢問他什么時候可以再次提供這項服務.
Update: The link isn't working in the moment. The wabpage says "We are redesigning things, will be back soon!". I allready sent antonio an email asking him, when this service will be available again.
安東尼奧說它會回來,但沒有預計到達時間.我們必須等待..
Antonio said that it'll be back but there is no estimated time of arrival. We have to wait..
這篇關于使用 Laravel 4 自動生成模型類(也就是使用帶有 L4 的現有數據庫)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!