N
N
NDll2022-03-15 16:30:19
Laravel
NDll, 2022-03-15 16:30:19

How to display the values ​​that are in two arrays?

From the front comes such an array of pictures

"images": [{"id": "01fy6vppzmrfza3bfwj89cr63b"}],

array:1 [
  0 => array:1 [
    "id" => "01fy6vppzmrfza3bfwj89cr63b"
  ]
]

I get images from the database that are loaded

ProductImage::where('product_id', $productId)->select('id', 'product_id', 'path', 'image')->get();

and they look like this

array:4 [
  0 => array:4 [
    "id" => "01fy6vrc8yjsmhy7h1j01rvhkb"
    "product_id" => "01fy6qndyz048vvq83ry844jbg"
    "image" => "62/126230926796087_16473503756145_5f602b856cb4a9204d8fd26fb1601514.png"
  ]
  1 => array:4 [
    "id" => "01fy6vrc9088r68hasc80zt0z6"
    "product_id" => "01fy6qndyz048vvq83ry844jbg"
    "image" => "56/126230926eaa85b_16473503826985_5f602b856cb4a9204d8fd26fb1601514.png"
  ]
  2 => array:4 [
    "id" => "01fy6vsgdyv23hzc13h83sjwbn"
    "product_id" => "01fy6qndyz048vvq83ry844jbg"
    "image" => "62/126230926796087_16473503756145_5f602b856cb4a9204d8fd26fb1601514.png"
  ]
  3 => array:4 [
    "id" => "01fy6vsge0xzcdac07xt74j2hp"
    "product_id" => "01fy6qndyz048vvq83ry844jbg"
    "image" => "56/126230926eaa85b_16473503826985_5f602b856cb4a9204d8fd26fb1601514.png"
  ]
]

how can I display the values ​​that are in that array and in the second one by id?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question