mercredi 15 avril 2020

Getting a particular data from instance

I am trying to make a shopping cart in Laravel, and I am still a learner.

In the cart, I am trying to print details of products present in the cart, along with their quantity.

The details of several products of cart is present in $prod, while quantity is present in $cart. I am running a foreach to access each product of the cart, as well as its quantity.

In an explanatory way, I am trying to do this:

@foreach( $prod as $p )
    <td>Quantity = <td>
@endforeach

I am trying to match the $p->id, the details which I am printing, to the quantity in $cart as $cart has it under product_id attribute in table.

I am sorry if I am unable to explain the question the right way.

Thank you.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire