Z
Z
zepy2018-09-28 09:07:05
Laravel
zepy, 2018-09-28 09:07:05

How to make communication between shared models in Laravel?

Hello! there are models like folder_* and document_* for each type, I created a model from which they are inherited and there are common properties for everyone, for example, DocumentNewsModel is inherited from DocumentModel, I think the logic is clear. And the question is what do I want to do in these general models with a hasMany connection, but when I try to create a document in the current folder, it cannot determine this folder, but tries to find the folder table. Please advise how best to implement this.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Gregory, 2018-09-28
@difiso

Most likely you need polymorphic relationships . Or you explained badly. An example code will help you understand better.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question