jeudi 24 octobre 2019

search within json array with comma seperate

I have this array saved in my database:

{
    "status": true,
    "info": [
        {
            "id": 1,
            "groups": "9,8"
        },
        {
            "id": 2,
            "groups": "7,13,12"
        },
        {
            "id": 3,
            "groups": "10,11,14,7,15"
        }
    ]
}

I need to search in this json with the "where" property in laravel 6.

For example: I want to set where groups comma separated contain the number 7, then -> only if number 7 exist in one of them it will be show.

Do you have some idea how to do it?

Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire