wearepixel / laravel-cart

MIT License
7 stars 1 forks source link

Livewire support for nested collection properties #16

Closed joelwmale closed 2 months ago

joelwmale commented 2 months ago

Although this package is not built specifically for Livewire, @wearepixel uses it for almost all of our client projects.

We currently retrieve conditions via the blade files due to the lack of support for collections inside collections that Livewire provides.

We should allow the following:

$this->cartConditions = \Cart::getConditions(array: true);

So that someone can store cart conditions on a Livewire component as an array, although right now this can be done manually by doing this:

$this->cartConditions = [];

foreach (\Cart::getConditions() as $condition) {
    $this->cartConditions[] = $condition->toArray();
}