3 ms·
I work on a project like this and you'll run into some papercuts, but it's not hard. You can take a model for anything in your legacy code, and just set proper
by pocketsand 4y ago
I work on a project like this and you'll run into some papercuts, but it's not hard.
You can take a model for anything in your legacy code, and just set properties on the model to teach Laravel how to deal with things that don't follow conventions.
For example, you can override the table name. Suppose you had a legacy table called "postdata". In Laravel, this table would be called posts, and a model would be Post.
So you'd just tell Post to query postdata rather than posts.
Likewise, you can tell it which fields to cast as dates, booleans, etc. You can tell it which fields represent timestamps for updating, creating, deleting and so forth.
You can setup relations that don't follow naming conventions the same way.
The only issue I've run into is doing things like setting up relationships across databases. You can do it, it's just not super straightforward.
I think you'll find it's a breath of fresh air to have a modern wrapper around your legacy code, and that your legacy stuff will then fit in quite nicely with your new work.
- BuckyBeaver 4y agoGreat, thanks! I’m pretty psyched to get started, after reading these comments.