public static function boot() { static::creating(function ($reply) { $reply->group_id = $reply->parent->group_id; }); static::created(function ($reply) { $reply->parent->increment('replies_count'); }); static::deleted(function ($reply) { $reply->parent->decrement('replies_count'); }); parent::boot(); }