1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 15:34:03 +00:00
tenancy/src/Database/Models/Concerns/GeneratesIds.php
Samuel Štancl 86a98b2bc8 Queue tests
2020-05-11 05:22:55 +02:00

17 lines
441 B
PHP

<?php
namespace Stancl\Tenancy\Database\Models\Concerns;
use Stancl\Tenancy\Contracts\UniqueIdentifierGenerator;
trait GeneratesIds
{
public static function bootGeneratesIds()
{
static::creating(function (self $model) {
if (! $model->id && app()->bound(UniqueIdentifierGenerator::class)) {
$model->id = app(UniqueIdentifierGenerator::class)->generate($model);
}
});
}
}