exists && $texture->public) { return; } $type = $texture->type == 'cape' ? 'tid_cape' : 'tid_skin'; $query = Player::where($type, $texture->tid); // texture was switched from "private" to "public" if ($texture->exists) { $query = $query->where('uid', '<>', $texture->uploader); } $query->update([$type => 0]); } }