0

Code:

    @if(Cart::count() > 0)
        @php
            dd(Cart::content());
        @endphp
    @endif

DD result

How can I access the "options" array? I can access id,qty & etc by simply running:

            @foreach(Cart::content() as $item)
            <tr>
                <td>{{$item->name}}</td>
                <td>{{$item->qty}}</td>
                <td>{{$item->price}}</td>
            </tr>
            @endforeach

But $item[options]->size doesn't work.

0

1 Answer 1

2

Based on the documentation of the package that you are using, you can access related models as properties. If Options is a model so:

$item->options->size

Would do the job.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.