Skip to content

Unset array replacing with null #1506

Closed
@prafful-panwar

Description

@prafful-panwar
            foreach ($event->volunteers as $key => $volunteer) {
                if ($volunteer['user_id'] == $userId) {
                    $event->where('volunteers.user_id', intval($userId))
                        ->unset("volunteers.$key");
                }
            }

Here is my DB structure

    "volunteers" : [
        null, 
        {
            "user_id" : NumberInt(1), 
            "name" : "Prafful  Panwar", 
            "skills" : [
                "Plumber"
            ], 
            "incentives" : {
                "tshirt_size" : "XXL"
            }, 
            "ready_to_contribute_min_amount" : "Yes", 
            "attendance_status" : false
        }
    ],

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions