mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-15 13:32:41 +08:00
improve hr + agent update
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user