Skip to content

Commit

Permalink
Add Snowflake casts to Eloquent Model example in docs (#188)
Browse files Browse the repository at this point in the history
Add snowflake casts to model example
  • Loading branch information
joshhanley authored Oct 30, 2024
1 parent b8b90dd commit 149272a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/ids.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,17 @@ A helper method you can use to generate a snowflake right out of the box: `snowf
For models that you're going to manage via events, pull in the `HasSnowflakes` trait:

```php
use Glhd\Bits\Database\HasSnowflakes;
use Glhd\Bits\Snowflake;

class JobApplication extends Model
{
use HasSnowflakes; // Add this to your model

// Any attribute can be cast to a `Snowflake` (or `Sonyflake`)
protected $casts = [
'id' => Snowflake::class,
];
}
```

Expand Down

0 comments on commit 149272a

Please sign in to comment.