0
我有三个表。雄辩的如何省略行如果值为空
- 客户
- 产品
- 评论 我用雄辩的映射这些表
。
例如,
在审查模式为客户详细信息我有一个像
public function customer(){
return $this->belongsTo('Customer', 'customer_id');
}
和产品细节功能我有功能类似
public function product(){
return $this->belongsTo('Product', 'product_id');
}
现在查询评论模型像
Review::all()->with(array('customer', 'product'))->get()
返回值。没事儿。但是,如果任何客户被删除,那么该行的值就是空的。相反,我需要省略那一行。如何在laravel中做到这一点。