improve hr + agent update

This commit is contained in:
xiaomlove
2025-07-21 20:55:30 +07:00
parent 84b554f102
commit ae08039323
26 changed files with 590 additions and 23 deletions

View File

@@ -2,6 +2,8 @@
namespace App\Models;
use App\Enums\ModelEventEnum;
class AgentAllow extends NexusModel
{
protected $table = 'agent_allowed_family';
@@ -20,6 +22,19 @@ class AgentAllow extends NexusModel
self::MATCH_TYPE_HEX => 'hex',
];
protected static function booted()
{
static::created(function ($model) {
fire_event(ModelEventEnum::AGENT_ALLOW_CREATED, $model);
});
static::updated(function ($model) {
fire_event(ModelEventEnum::AGENT_ALLOW_UPDATED, $model);
});
static::deleted(function ($model) {
fire_event(ModelEventEnum::AGENT_ALLOW_DELETED, $model);
});
}
public function denies(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(AgentDeny::class, 'family_id');