classMapper; /** @var \UserFrosting\Support\Repository\Repository $config */ $config = static::$ci->config; if ($this->isForceDeleting() && !$config['users.purge_activities']) { // Keep the activity log, but lose the user field $classMapper->getClassMapping('activity')::query() ->where('user_id', $this->id) ->update(['user_id' => null]); $this->refresh(); } return true; } static public function bootUserPermanentlyDeletable() { static::deleting(function ($user) { if (!$user->preventActivityPurge()) { return false; } return true; }); } }