samedi 1 juillet 2017

Laravel intelligent array matches

I have a lot of relation in my laravel project. I started to make a search. Now I have more multidimensional arrays,what I need to check in all array wich value is avaible?! So my arrays:

array:4 [▼
  "bytype" => array:2 [▼
    0 => array:6 [▼
      "id" => 1
      "price" => 500
      "discount_price" => null
      "created_at" => null
      "updated_at" => null
      "pivot" => array:2 [▶]
    ]
    1 => array:6 [▼
      "id" => 3
      "price" => 1400
      "discount_price" => null
      "created_at" => null
      "updated_at" => null
      "pivot" => array:2 [▶]
    ]
  ]
  "bymake" => array:2 [▼
    0 => array:6 [▼
      "id" => 1
      "price" => 500
      "discount_price" => null
      "created_at" => null
      "updated_at" => null
      "pivot" => array:2 [▶]
    ]
    1 => array:6 [▼
      "id" => 3
      "price" => 1400
      "discount_price" => null
      "created_at" => null
      "updated_at" => null
      "pivot" => array:2 [▶]
    ]
  ]
  "bymodel" => array:1 [▼
    0 => array:6 [▼
      "id" => 2
      "price" => 1500
      "discount_price" => null
      "created_at" => null
      "updated_at" => null
      "pivot" => array:2 [▶]
    ]
  ]
  "byattribute" => array:3 [▼
    0 => array:6 [▼
      "id" => 1
      "price" => 500
      "discount_price" => null
      "created_at" => null
      "updated_at" => null
      "pivot" => array:2 [▶]
    ]
    1 => array:6 [▼
      "id" => 2
      "price" => 1500
      "discount_price" => null
      "created_at" => null
      "updated_at" => null
      "pivot" => array:2 [▶]
    ]
    2 => array:6 [▼
      "id" => 3
      "price" => 1400
      "discount_price" => null
      "created_at" => null
      "updated_at" => null
      "pivot" => array:2 [▶]
    ]
  ]
]

So how can I do this to get that value(its means that array) wich one is avaible in all of that 4 main array?

to be like that:

  "listable" => array:2 [▼
    0 => array:6 [▼
      "id" => 1
      "price" => 500
      "discount_price" => null
      "created_at" => null
      "updated_at" => null
      "pivot" => array:2 [▶]
    ]
    1 => array:6 [▼
      "id" => 3
      "price" => 1400
      "discount_price" => null
      "created_at" => null
      "updated_at" => null
      "pivot" => array:2 [▶]
    ]
  ]



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2srLhoK
via IFTTT

Aucun commentaire:

Enregistrer un commentaire