#Polymorphic relationships

8 messages · Page 1 of 1 (latest)

lost tusk
#

I would like to ask if there is a way without doing a migration to support polymorphic relationships with models on the App folder and models on the App\Models directory

the reason why migration is not an option is because there is a Laravel 7 app that is using the database in parallel

thanks!

flat fulcrum
#

If I get you correctly you mean polymorphs without namespace right?

molten basin
#

do you mean you have 2 Laravel apps using the same database, and one has models in the app/models directory, and the other just has models in the app directory?

slow dawn
#

you would have to change the structure for both apps or combine them into one (seems best if they feed from the same db) or opt for a central api which both apps use

#

two apps with direct database access should not be happening in the first place imo

#

so I would advice to change your structure rather than finding a way to achieve what you want.. and then roll with the normal approach

#

keeping your approach will have you run into the same issue with every db change in the future

lost tusk
#

do you mean you have 2 Laravel apps using the same database, and one has models in the app/models directory, and the other just has models in the app directory?

  • Yes, I would like to check if there is a way to support both on the Laravel v10 version without having to do migrations