Specify MorphTo model #52336
Unanswered
GautierDele
asked this question in
Ideas
Replies: 2 comments 1 reply
-
Nothing new here ? |
Beta Was this translation helpful? Give feedback.
0 replies
-
I did a article about that - |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello there,
In my use of Laravel I have several problem coming from the
morphTo
relation because i'm not able to know what's related (this is the only relation behaving like this).A solution would be to use a
belongsTo
relation but this breaks the SQL constraints of having a single model relatedIn my opinion it would be great to be able to specify optionnally what model you want from the relation so you avoid misleading results
Is this something that has been considered ? Or could be a great idea ?
My major problem is from my open source package: https://laravel-rest-api.lomkit.com/resources/relationships#morph-to
The workarrond i'm giving:
This is pretty bad for performances ... But this works
Beta Was this translation helpful? Give feedback.
All reactions