Skip to content

Commit 39713c9

Browse files
committed
wip
1 parent 7a3ef41 commit 39713c9

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

fields.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ $group = Fieldset::make(__('Billing Fields'), 'billing')
283283
->withFields(static function (): array {
284284
return [
285285
Text::make(__('Name'), 'billing_name'),
286-
Email::make(__('Email', 'billing_email')),
286+
Email::make(__('Email'), 'billing_email'),
287287
];
288288
});
289289
```
@@ -434,7 +434,7 @@ $field = Slug::make(__('Slug'), 'slug')
434434
->from(['name']);
435435
```
436436

437-
You may also want to have unique slugs, which means when a slug is already exists in the databse table, the new slug will get an incremented numeric suffix to avoid conflicts:
437+
You may also want to have unique slugs, which means when a slug is already exists in the database table, the new slug will get an incremented numeric suffix to avoid conflicts:
438438

439439
```php
440440
$field->unique();
@@ -524,7 +524,7 @@ Relation fields are representing Eloquent relation definitions on the resource m
524524

525525
### Configuration
526526

527-
### Searchable & Sortable Columns
527+
#### Searchable & Sortable Columns
528528

529529
#### Customizing the Query
530530

@@ -554,6 +554,20 @@ $field->withRelatableQuery(function (Request $request, Builder $query, Model $mo
554554

555555
#### Formatting
556556

557+
You may format the relatable models. By default the ID is displayed, but you can customize the format easily:
558+
559+
```php
560+
$field->display('name');
561+
```
562+
563+
Alternatively, you may pass a `Closure` to have an apply formatting logic:
564+
565+
```php
566+
$field->display(static function (Model $model): string {
567+
return strtoupper($model->name);
568+
});
569+
```
570+
557571
#### Aggregates
558572

559573
#### Grouping

0 commit comments

Comments
 (0)