I have a model with a custom accessor so I get that custom attribute,
class Order extends GSModel{
$appends = [\'orderContents\'];
publ
Okay I'm not saying this is a good solution, but it works and you get around using a loop...
Add this to your model:
public static $withoutAppends = false;
protected function getArrayableAppends()
{
if(self::$withoutAppends){
return [];
}
return parent::getArrayableAppends();
}
Then when you want to disable the $appends properties:
Order::$withoutAppends = true;
$openOrders = Order::open()->has('contents')->get(['id','date','tableName']);