Skip to content

Commit

Permalink
Document new contract
Browse files Browse the repository at this point in the history
  • Loading branch information
rawilk committed Oct 4, 2024
1 parent 3034500 commit 11af8f0
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/usage/name.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,20 @@ $name = Name::from('Randall James Wilk');
echo $name->full; // Randall James Wilk
echo $name->initials; // RJW
```

## Edge Cases

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:

```php
<?php

namespace App\Models;

use Rawilk\LaravelCasters\Contracts\HasSingleNameColumn;

class User extends Model implements HasSingleNameColumn
{
// ...
}
```

0 comments on commit 11af8f0

Please sign in to comment.