Код: Выделить всё
$this->items = collect([
$productId => [
'name' => $product->title,
'price' => $product->price,
'is_sale' => $product->is_sale,
'sale_price' => $product->sale_price,
'sale_percent' => $product->sale_percent,
'can_use_promocode' => $product->can_use_promocode,
'qty' => 1,
];
]);
Код: Выделить всё
$this->itemsаналогичный для функций PHP array_key_exists , но для коллекций.
Подробнее здесь: https://stackoverflow.com/questions/483 ... n-with-key
Мобильная версия