1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 19:54:03 +00:00

Queue tests

This commit is contained in:
Samuel Štancl 2020-05-11 05:22:55 +02:00
parent 00bb0d06b3
commit 86a98b2bc8
13 changed files with 216 additions and 124 deletions

View file

@ -2,13 +2,15 @@
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 && config('tenancy.id_generator')) {
$model->id = app(config('tenancy.id_generator'))->generate($model);
if (! $model->id && app()->bound(UniqueIdentifierGenerator::class)) {
$model->id = app(UniqueIdentifierGenerator::class)->generate($model);
}
});
}