Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autogenerate model classes with Laravel 4 (aka using an existing database with L4)

I've designed my database in MySQL Workbench, and have all my foreign keys setup, etc.

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.

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.

Is this even possible with Laravel 4 or am I going to have to just do it all manually?

like image 248
Sk446 Avatar asked Dec 11 '22 15:12

Sk446


1 Answers

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.

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..

like image 115
Hexodus Avatar answered May 04 '23 01:05

Hexodus