Aşağıdaki query normal bir şekilde çalışıyor.
ProductVariant::where('product_id', 2)
->get()
->groupBy('property_name_id');
Bu kodu livewire komponentinin mount metodunda aşağıdaki gibi kullanıyorum
$this->productVariantGroups = ProductVariant::where('product_id', 2)
->get()
->groupBy('property_name_id');
"productVariantGroups" özelliğini komponentte önceden tanımlamamışsam kod düzgün çalışıyor ama public $productVariantGroups = [];
şeklinde veya public $productVariantGroups;
şeklinde önceden tanımlamışsam aşağıdaki hatayı alıyorum
Method Illuminate\Database\Eloquent\Collection::getKey does not exist.