so I have this code:
$collectionOfProducts = \DB::table('products_specif')->whereIn('size',$arrayOfAttributes)->whereIn('color',$arrayOfAttributes)->whereIn('material',$arrayOfAttributes)->get('product_code');
$product_codes = $collectionOfProducts->unique();
dd($product_codes->toArray());
$arrayOfProducts = \DB::table('products')->whereIn('product_code',$product_codes)->get();
return view('pages.products', compact('arrayOfProducts','type'));
the dd() responds with:
array:4 [▼
0 => {#1252 ▼
+"product_code": "SocksCode"
}
4 => {#1257 ▶}
9 => {#1262 ▶}
13 => {#1266 ▶}
]
I would like to use the $product_codes in my whereIn statement, but I can't because of those numbers at the start(0,4,9,13). How do I convert this collection/array to just a simple "product_code" : "code" array?