Skip to content

Commit

Permalink
Update fields.md
Browse files Browse the repository at this point in the history
  • Loading branch information
noxoua authored Nov 14, 2023
1 parent 5e75d02 commit a7be7d2
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions docs/fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,13 @@ $logger
->fields([
Field::make('items')
->hasMany('items')
->table(differenceOnly: true)
->resolveStateUsing(static function (Model $record) {
return $record->items->map(fn ($item) => [
'Product' => $item->product->name,
'Quantity' => $item->qty,
'Unit Price' => $item->unit_price,
])->toArray();
})
->table([
Field::make('product.name')->hasOne('product'),
Field::make('qty'),
Field::make('unit_price'),
])
->label('Items'),
])
]),
```

![Screenshot](./assets/images/table-screenshot.png)
Expand Down

0 comments on commit a7be7d2

Please sign in to comment.