Skip to content

Getting error on Multidimensional array search #56

@takielias

Description

@takielias

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions