mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 20:54:04 +00:00
vague first draft of v3. TenantModelTest is passing
This commit is contained in:
parent
c2c90ff755
commit
bd9aad229b
56 changed files with 803 additions and 1366 deletions
15
src/Database/Models/Concerns/GeneratesIds.php
Normal file
15
src/Database/Models/Concerns/GeneratesIds.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Database\Models\Concerns;
|
||||
|
||||
trait GeneratesIds
|
||||
{
|
||||
public static function bootGeneratesIds()
|
||||
{
|
||||
static::creating(function (self $model) {
|
||||
if (! $model->id && config('tenancy.id_generator')) {
|
||||
$model->id = app(config('tenancy.id_generator'))->generate($model);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue