假设我们有两个表:
products product_langs
============== ==============
id id_product
name lang
description
现在我想将这两个表格链接起来,就像这样:
return $product->hasOne('App/ProductLang')
->where('id_product', '=', 'id')
->where('lang', '=', $lang);
有没有不需要模型 App/ProductLang
的 开箱即用 方案可以做到这一点?