Filament Serial Number generator
Good day Filament master!!
Can someone please help me how can i achieve these?
1. Create a random custom serial number when a record is created
2. Create a serialized custome serial number when a record is created
3 Replies
It's not really Filament related. From Filament side you could use the
mutateFormDataBeforeSave
. But it's probably better to use Laravel's model events static::creating()
.
Not sure what's a "serialized serial number".well....in layman's term here serial number means a bunch of characters/numbers for identification. serialized means its consecutive. And yes I can understand the confusion as I was also confused at them first here hahahaha
will check with that model's events
a sample of the expected output would be
ABC-123c21hgi
or
1231-22231-sg123j-dha2
Checkout : https://laravel.com/docs/11.x/strings#method-str-ulid or https://laravel.com/docs/11.x/strings#method-str-uuid
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.