->where(function ($query) use ($slug) {
$query->where('name', 'LIKE', '%' . $slug . '%');
$query->orWhere('short_description', 'LIKE', '%' . $slug . '%');
$query->orWhere('description', 'LIKE', '%' . $slug . '%');
$query->orWhere('meta_keywords', 'LIKE', '%' . $slug . '%');
})
->whereNull('deleted_at');
function get_price_by_market_hash(array $prices, string $market)
{
foreach ($prices as $price) {
if ($price['market_hash_name'] === $market) {
return (float) $price['price'];
}
}
return null;
}
var_dump(
get_price_by_market_hash(
$data['prices'],
'AK-47 | Aquamarine Revenge (Field-Tested)'
)
);
// float(166.07)