DB persistence with seeders #21
-
How do you generate persistent db hashes with database seeders? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
have you tried using class User extends Model
{
use HashableId;
protected $shouldHashPersist = true;
// your hash column name
protected $hashColumnName = 'hashid';
} and make sure you are not using |
Beta Was this translation helpful? Give feedback.
-
I realized the reason it wasn't working is because I was using direct DB inserts and not model generations. The seeders were originally set up per Laravel docs (https://laravel.com/docs/9.x/seeding#writing-seeders). I updated my seeders to seed with models. That did the trick! Thank you. |
Beta Was this translation helpful? Give feedback.
I realized the reason it wasn't working is because I was using direct DB inserts and not model generations.
The seeders were originally set up per Laravel docs (https://laravel.com/docs/9.x/seeding#writing-seeders).
I updated my seeders to seed with models. That did the trick!
Thank you.