mirror of
https://github.com/stancl/tenancy-docs.git
synced 2025-12-12 10:14:03 +00:00
3.x redesign
This commit is contained in:
parent
857122540f
commit
f8f354c323
229 changed files with 201175 additions and 22440 deletions
28
source/docs/v2/misc-tips.blade.md
Normal file
28
source/docs/v2/misc-tips.blade.md
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
title: Miscellaneous Tips
|
||||
description: Miscellaneous Tips..
|
||||
extends: _layouts.documentation
|
||||
section: content
|
||||
---
|
||||
|
||||
# Miscellaneous Tips {#misc-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:
|
||||
|
||||
```php
|
||||
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.unique_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.
|
||||
Loading…
Add table
Add a link
Reference in a new issue