Support the ongoing development of →
Configuration Database
Last updated 2 years ago.

I figured it out...

Let’s say your source database is MySQL and you have a client table with client_id and client_name columns. On your Laravel project you have a clients table with id, client_name, created_at, and updated_at columns. Add a new connection to your /app/config/database.php. If you have multiple MySQL databases, it’s okay, just append 2… so you have a mysql and mysql2 connection. So your mysql array connection holds your Laravel database and mysql2 holds your database connection information where you’ll be getting data from. Next edit the /app/database/seeds/DatabaseSeeder.php file. Here’s what I have.

here's the seed code (version 1) (version 2, supports multiple tables)... i meant to use $result[]

Last updated 2 years ago.

Sign in to participate in this thread!


Your banner here too?

w1n78 w1n78 Joined 21 Apr 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.