-
app/Product.php
Open in GitHubclass Product extends Model { // public function getTotalAttribute() { return $this->price * $this->pivot->quantity; } }
-
resources/views/components/product-card.blade.php
Open in GitHub// <p class="card-text"> {{ $product->pivot->quantity }} in your cart <strong>(${{ $product->total }})</strong> </p> //