Can you help me how can I solve this.. I am trying to display the values from the foreach array.. Relationship makes me more complicated to understand so I opt to do it on my way.
It displays an error of like this
Property [pic] does not exist on this collection instance.
$dataTagged = DB::table('tagging_tagged')
->where('tag_slug', '=',$slug)
->get();
foreach($dataTagged as $tagged){
$dataProductquantity[] = Productquantity::where('id','=',$tagged->taggable_id)->first();
}
and my view is
@foreach($dataProductquantity as $Productquantity)
<div class="col-lg-4 col-md-6 mb-4">
<div class="card h-100">
<a href="#"><img class="card-img-top" src="{{ asset('productimg') }}/{{$Productquantity->pic}}" alt=""></a>
<div class="card-body">
<h4 class="card-title">
<a href="#">{{$Productquantity->product->product_name}}</a>
</h4>
<h5>₱ {{$Productquantity->price}}.00 </h5>
<p class="card-text">{{$Productquantity->description}}</p>
</div>
<div class="card-footer" align="center">
<a class="btn btn-warning" align="center"><i class="icon-shopping-cart"></i><span style="color:#fff;">Add to Cart</span></a>
</div>
</div>
</div>
@endforeach
please help. Thank you