Big changes added events for decisions
This commit is contained in:
@@ -49,6 +49,12 @@ protected static function booted()
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
static::created(function (Activity $activity) {
|
||||
if (! empty($activity->decision_id)) {
|
||||
event(new \App\Events\ActivityDecisionApplied($activity));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function action(): BelongsTo
|
||||
|
||||
@@ -29,7 +29,9 @@ public function actions(): BelongsToMany
|
||||
|
||||
public function events(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(\App\Models\Event::class);
|
||||
return $this->belongsToMany(\App\Models\Event::class)
|
||||
->withPivot(['run_order', 'active', 'config'])
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function activities(): HasMany
|
||||
|
||||
@@ -11,6 +11,18 @@ class Event extends Model
|
||||
/** @use HasFactory<\Database\Factories\EventFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'name', 'key', 'description', 'active', 'config',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'active' => 'boolean',
|
||||
'config' => 'array',
|
||||
];
|
||||
}
|
||||
|
||||
public function decisions(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(\App\Models\Decision::class);
|
||||
|
||||
Reference in New Issue
Block a user