Is it possible to have eager loading without $append
attributes? I have following code:
Product model:
public function category(): BelongsTo
{
return $this
->belongsTo(ProductCategory::class, 'product_category_id');
}
public static function adminTableData(): Builder
{
return self::query()->select('*')
->with(['category' => function($query)
{
return $query->select('id', 'name');
}]);
}
Company model:
protected $appends = [
'admin_table_logo',
'edit',
'remove',
];
2
Answers
Yes you can. Like this. I commented inline:
You can try this.
Modify adminTableData function
The answer is based on how to ignore accessor