jsonq icon indicating copy to clipboard operation
jsonq copied to clipboard

Getting error on Multidimensional array search

Open takielias opened this issue 4 years ago • 3 comments

This is my json array

[
  {
    "name": "post11",
    "type": "fields",
    "fields": [
      {
        "name": "background_color",
        "type": "select",
        "options": {
          "rules": "required",
          "value": "#FFFFFF",
          "wrapper": {
            "class": "col-md-6"
          },
          "choices": {
            "#ECECEC": "Grey",
            "#FFFFFF": "White"
          },
          "selected": "#ECECEC",
          "content_type": "select",
          "error_messages": {
            "background_color.required": "Background Color is mandatory."
          }
        }
      },
      {
        "name": "post1_title",
        "type": "text",
        "options": {
          "wrapper": {
            "class": "col-md-6"
          },
          "value": "",
          "rules": "required",
          "content_type": "text"
        }
      }
    ]
  },
  {
    "name": "post12",
    "type": "fields",
    "fields": [
      {
        "name": "post1",
        "type": "textarea",
        "options": {
          "wrapper": {
            "class": "col-md-6"
          },
          "rules": "required|min:5",
          "value": "",
          "content_type": "textarea",
          "error_messages": {
            "post1.required": "Post1 is mandatory."
          }
        }
      },
      {
        "name": "modal1_view",
        "type": "textarea",
        "options": {
          "wrapper": {
            "class": "col-md-6"
          },
        "content_type": "editor",
        "attr": {
          "class": "form-control editor"
        },
          "value": ""
        }
      }
    ]
  },
  {
    "name": "post13",
    "type": "fields",
    "fields": [
      {
        "name": "internal1_url",
        "type": "text",
        "options": {
          "wrapper": {
            "class": "col-md-6"
          },
          "value": "",
          "content_type": "text"
        }
      },
      {
        "name": "image1",
        "type": "file",
        "options": {
          "wrapper": {
            "class": "col-md-6"
          },
          "value": "",
          "content_type": "text"
        }
      }
    ]
  },
  {
    "attr": {
      "class": "btn btn-primary pull-right"
    },
    "name": "submit",
    "type": "submit"
  }
]

I need to search content_type = editor.

$jsonq->from("fields")->where("content_type", "=", "select")->get();

But I'm getting

ErrorException
array_filter() expects parameter 1 to be array, object given

How can I fix it?

takielias avatar Jun 29 '20 15:06 takielias

This is not an issue I think. You are execute a wrong query.

nahid avatar Jul 03 '20 18:07 nahid

@takielias

Have you solved this query ? if yes please share I am also stuck.

neeraj479 avatar Jul 14 '22 10:07 neeraj479

@takielias

Have you solved this query ? if yes please share I am also stuck.

Sorry, I could not make it. I'm also looking for a solution.

takielias avatar Jul 14 '22 10:07 takielias