I have a model with a custom accessor so I get that custom attribute,
class Order extends GSModel{
$appends = ['orderContents'];
public function getOrderContentsAttribute()
{
return $this->contents()->get();
}
}
But now, in one case, I need to get only some fields, without this OrderContents
one.
$openOrders = Order::open()->has('contents')->get(['id','date','tableName']);
But doing it this way, it returns me the OrderContents
as well..
is there a way to not get that field?
Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…