Skip to content

Commit 11af8f0

Browse files
committed
Document new contract
1 parent 3034500 commit 11af8f0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/usage/name.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,20 @@ $name = Name::from('Randall James Wilk');
156156
echo $name->full; // Randall James Wilk
157157
echo $name->initials; // RJW
158158
```
159+
160+
## Edge Cases
161+
162+
In some instances you may have issues using the cast on models with a single name column in the database. To help the cast serialize the model's name correctly for storage, you may implement the `HasSingleNameColumn` contract on your model, like this:
163+
164+
```php
165+
<?php
166+
167+
namespace App\Models;
168+
169+
use Rawilk\LaravelCasters\Contracts\HasSingleNameColumn;
170+
171+
class User extends Model implements HasSingleNameColumn
172+
{
173+
// ...
174+
}
175+
```

0 commit comments

Comments
 (0)