tenancy-docs/source/docs/v2/misc-tips.blade.md
Taha Moghaddam 1b5ff75a7d
Update misc-tips.blade.md
Fix invalid config key
2026-02-14 09:56:28 +03:30

849 B

title description extends section
Miscellaneous Tips Miscellaneous Tips.. _layouts.documentation content

Miscellaneous Tips

Custom ID scheme

If you don't want to use UUIDs and want to use something more human-readable (even domain concatenated with uuid, for example), you can create a custom class for this:

use Stancl\Tenancy\Contracts\UniqueIdentifierGenerator;

class MyUniqueIDGenerator implements UniqueIdentifierGenerator
{
    public static function generate(array $domains, array $data = []): string
    {
        return $domains[0] . \Ramsey\Uuid\Uuid::uuid4()->toString();
    }
}

and then set the tenancy.id_generator config to the full path to your class.

Note that you may have to make the id column on the tenants table larger, as it's set to the exact length of uuids by default.