在模型Laravel中的两个表之间相关

时间:2017-10-26 04:03:46

标签: php mysql laravel-5.3

我有一个问题,我如何在模型函数中关联两个表? 我想关联表商店和订单,但我无法将它们联系起来。 你可以帮帮我吗?

这是我的商店表 enter image description here

这是我的订单表 enter image description here

更新 这是我的代码



public function order()
    {
        return $this->belongsTo(Order::class,'id','store_id');
    }




0 个答案:

没有答案