codemode's avatar

Moving a live website from a CMS to Laravel

Hello,

I have a fairly ok traffic generating website that i build a few years ago, it uses a PHP CMS and i wanted to rewrite a basic version of the project in Laravel, as the devs of the CMS purged the project.

Since i want to use the previous DB data, what would be the possible ways to move that data into the new DB?

I know this is a very broad question to ask, but i'm sure i will need to modify the DB structure a bit. Any suggestions are appreciated, many thanks!

0 likes
4 replies
jlrdw's avatar

A first step is looking over the docs to understand some laravel conventions.

But on many relations you can bypass with a second argument.

You can either work out migrations, or just use existing data. Eloquent uses normal sql / pdo.

You can even write normal queries using db facade or getPdo(), for some of the queries.

Bottom line, laravel is a very flexible easy to use framework, you have to try to make it hard.

Perhaps load up all and play around some, practice first.

codemode's avatar

Thanks @jlrdw i sure will have to rewrite the code, don't want it to just die out.

Condition: If i set up a new Laravel project, Is there a way we can save the data on a DB, when we do a "migration:refresh" command, or something similar? In other words, when we change the DB structure, without destroying the data?

Thanks

Sinnbeck's avatar

If there isn't that many tables, you could just use migrations to recreate them, and when the new website is ready, just use an sql editor like dbeaver to export the data of each table to an sql file, and then manually import each into the new database. It's a one time thing and shouldn't take long

martinbean's avatar

@codemode Re-factoring a project to a ne framework is a massively open question. It completely depends on the size of the site and what CMS it’s currently using as to how you would approach it, and whether you want to “morph” the current CMS code into a Laravel application, or just create a new Laravel application that does the same functionality and then move the data over once the Laravel version’s ready.

Please or to participate in this conversation.