Support the ongoing development of Laravel.io →
Configuration Database Eloquent

I plan to make 2 different laravel projects ( At Dedicated Server where each project has a different virtual subdomain ) that communicate with the same mysql database (at localhost).

The project number 1 has a table in database named "arguments" (eloquent model ) and the project number 2 must use this table (read and updates).

I have already setup the project No 1 and now am wondering on how implementing th project no 2. I think that i should write again in Project no 2 an exactly same eloquent model for this table. But is it right? Is it clear? What will be happen when i make migrations?

Thank you in advance!

P.S: Perhaps in the future bought another one dedicated server only for the project No 2....

Last updated 3 years ago.
0

I had the same issue, what I did was create a library (eloquent model) that handles all those things. Just like you mentioned.

Last updated 3 years ago.
0

Hi ruk33!! Thanks for your answer!

Do you Have any problems with migrations?

Last updated 3 years ago.
0

You're welcome. No I didn't. You shouldn't have any problems with migrations though (at least I can't imagine one now).

Last updated 3 years ago.
0

Yes, just define the same Eloquent model again in project #2.

To be on the safe side though, you should create and execude the migration-files only from one project's context.

Last updated 3 years ago.
0

Thank you so much Sisou!!!

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

gcreator gcreator Joined 9 May 2014

Moderators

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

Your logo here?

Laravel.io

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

© 2025 Laravel.io - All rights reserved.