Let’s start with the idea of finding the shop_id in the goods table based on the goodsiD in order_goods, and then finding the name in the shop table based on the shop_id. The order_goods table is not related to the shop table
I imitate the writing in TP5
public function shop( )
{
return $this->hasManyThrough('Shop','Goods','goods_id','shop_id','id')->setEagerlyType(0);
}
hasManyThrough('Associated model name', 'Intermediate model name', 'Foreign key name', 'Intermediate model associated key name', 'Current model primary key name', ['Model alias definition']);
is the following I don’t know how to write the parameters. Can any experts give me some advice?
Please open trace and post the generated SQL statement