over naar uuids, policies, predefined mutations aan kunnen passen
This commit is contained in:
@@ -34,6 +34,11 @@ class Dynamic extends Model
|
||||
return $this->hasMany(DynamicInvitation::class);
|
||||
}
|
||||
|
||||
public function predefinedMutations(): HasMany
|
||||
{
|
||||
return $this->hasMany(PredefinedMutation::class);
|
||||
}
|
||||
|
||||
public function chat(): MorphOne
|
||||
{
|
||||
return $this->morphOne(Chat::class, 'chatable');
|
||||
@@ -41,8 +46,17 @@ class Dynamic extends Model
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::creating(function ($model) {
|
||||
$model->uuid = (string) \Illuminate\Support\Str::uuid();
|
||||
});
|
||||
|
||||
static::created(function (Dynamic $dynamic) {
|
||||
$dynamic->chat()->create([]);
|
||||
});
|
||||
}
|
||||
|
||||
public function getRouteKeyName()
|
||||
{
|
||||
return 'uuid';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ class Ledger extends Model
|
||||
'rules',
|
||||
'score',
|
||||
'alignment',
|
||||
'status',
|
||||
];
|
||||
|
||||
public function dynamic(): BelongsTo
|
||||
@@ -40,4 +41,16 @@ class Ledger extends Model
|
||||
{
|
||||
return $this->morphMany(Media::class, 'mediable');
|
||||
}
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::creating(function ($model) {
|
||||
$model->uuid = (string) \Illuminate\Support\Str::uuid();
|
||||
});
|
||||
}
|
||||
|
||||
public function getRouteKeyName()
|
||||
{
|
||||
return 'uuid';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,10 @@ class Mutation extends Model
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::creating(function ($model) {
|
||||
$model->uuid = (string) \Illuminate\Support\Str::uuid();
|
||||
});
|
||||
|
||||
static::created(function (Mutation $mutation) {
|
||||
$mutation->chat()->create([]);
|
||||
|
||||
@@ -87,4 +91,9 @@ class Mutation extends Model
|
||||
broadcast(new \App\Events\MessageSent($dynamicMsg));
|
||||
});
|
||||
}
|
||||
|
||||
public function getRouteKeyName()
|
||||
{
|
||||
return 'uuid';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,14 +11,27 @@ class PredefinedMutation extends Model
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'ledger_id',
|
||||
'dynamic_id',
|
||||
'name',
|
||||
'description',
|
||||
'amount',
|
||||
'type',
|
||||
];
|
||||
|
||||
public function ledger(): BelongsTo
|
||||
public function dynamic(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Ledger::class);
|
||||
return $this->belongsTo(Dynamic::class);
|
||||
}
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::creating(function ($model) {
|
||||
$model->uuid = (string) \Illuminate\Support\Str::uuid();
|
||||
});
|
||||
}
|
||||
|
||||
public function getRouteKeyName()
|
||||
{
|
||||
return 'uuid';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,4 +69,16 @@ class User extends Authenticatable implements PasskeyUser
|
||||
'two_factor_confirmed_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::creating(function ($model) {
|
||||
$model->uuid = (string) \Illuminate\Support\Str::uuid();
|
||||
});
|
||||
}
|
||||
|
||||
public function getRouteKeyName()
|
||||
{
|
||||
return 'uuid';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user