@veur of course, all types of relations eith examples described here: https://laravel.com/docs/8.x/eloquent-relationships#polymorphic-relationships
If you need more detailed help - provide your real models
I have a Polymorphic Relation in which I store the *_type and the *_id, for example:
model_type = 'App\Models\Post' model_id = 1
Is there a Laravel (helper) function to get an Eloquent instance of this Post with id 1?
Just use a simple where
->where([
['model_type', '=', 'App\Model\Post' ],
[ 'model_id', '=', 1]
])
Please or to participate in this conversation.