Closed mzcoder-hub closed 2 years ago
I haven't done this exact scenario before. I do use it to seed multiple databases, so I know that it can work, but I use another package for a specific use case that manages the connection so that doesn't make for a good recipe for you.
This answer looks like it probably has what you need: https://stackoverflow.com/questions/26654846/use-one-laravel-migrations-table-per-database
I think the key items are:
php artisan migrate --database="db1" --path="app/database/migrations/db1"
php artisan migrate --database="db2" --path="app/database/migrations/db2"
php artisan db:seed --database="db1" --class="Database\Seeders\Database1Seeder"
php artisan db:seed --database="db2" --class="Database\Seeders\Database2Seeder"
If you want to use the default seeder class for one of them, you would omit the --class=
. Similar with migrations.
Try it out and update this issue with the results.
ok thanks for the answer maybe you need to make its for the good use haha,
hi, I'm confusing how do I run the seeder in the specific connection ?
Schema::connection('public')->
its look like that ? in this case im using multi databases