如何从laravel mongodb jessenger中的关系收集表中选择特定的列 [英] how to select particular column from relationship collection table in laravel mongodb jessenger

查看:121
本文介绍了如何从laravel mongodb jessenger中的关系收集表中选择特定的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据库中有3列. 2列通过混合关系与1列连接. 这是我的查询.

I have 3 columns in my database. 2 columns is connected with one column by using a hybrid relationship. here is my query.

$data=Client::with('product','department')->select(['product.product_name','product.product_description']);

如何从另一个表中选择行?

how to select row from another table?

推荐答案

用所有锻造键进行选择他们喜欢

in your product or department relation method do the selection with all the forging keys if you have any other relation for product for later use is you want them like

public function product()
{
    return $this->hasMany(department::class)->select(['id', 'another_relation_to_product_id', 'product_name', 'product_description']);
}

这篇关于如何从laravel mongodb jessenger中的关系收集表中选择特定的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆