Laravel multiple morph relation in one table

932 Views Asked by At

i have problem in laravel. i have created multiple morph in one table.

table structure 
table_name : morphicable
id: 
model_id:       eg: '1'
model_type:     eg 'model/comment'

model_one_id:   eg: '1'
model_one_type: eg 'model/order'

in above relationship we can saving the data from comment to order and order to comment like many to manay.

Now the problem is that how to get the both data from one ORM method. like some time we save comment in model type and some time in model typeOne.

i want to get the data from both models in one go.

public function morphicable(): MorphMany
{
    return $this->morphMany(morphicable::class, 'model');
}
0

There are 0 best solutions below