Skip to content

Commit cea44cb

Browse files
committed
- Updated docs
1 parent 327853e commit cea44cb

1 file changed

Lines changed: 0 additions & 31 deletions

File tree

docs/basic-usage/model-export.md

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -119,37 +119,6 @@ class UsersExport extends ModelExport
119119
}
120120
```
121121

122-
## Formatting a specific attribute
123-
124-
To format a specific attribute in the exported file, override the `formatValue` method. Remember to call `parent::formatValue` to still maintain formatting for other attributes.
125-
126-
```php
127-
<?php
128-
129-
namespace App\Exports;
130-
131-
use Javaabu\Exports\ModelExport;
132-
use App\Models\User;
133-
134-
class UsersExport extends ModelExport
135-
{
136-
137-
public function modelClass(): string
138-
{
139-
return User::class;
140-
}
141-
142-
public function formatValue(string $attribute, mixed $value): mixed
143-
{
144-
if ($attribute == 'role' && $value instance of \App\Models\Role::class) {
145-
return $value->description;
146-
}
147-
148-
return parent::formatValue($attribute, $value);
149-
}
150-
}
151-
```
152-
153122
## Modifying the headings
154123

155124
To modify the headings, override the `headings` method. Remember to include all the headings in the correct order and to include a heading for each allowed attribute.

0 commit comments

Comments
 (0)