how to use where which is in foreach in laravel blade, i want to display only data with status true
I’ve tried using where in several positions in foreach but still getting error
@foreach ($getfab as $tes)
<div class="container">
{{ $tes->listfab->Name }} |
{{ $tes->listfab->Status }}
<br><br>
</div>
@endforeach
public function product_detail($id){
$getfab = ProductItem::where('FrameCode',$list->FrameCode)
->with('listfab')->get();
return view('frontend/products/product-detail',compact(''getfab'));
}
class FabricList extends Model
{
use HasFactory;
protected $table = "t_fabric_list";
public function itemfab(){
return $this->hasMany(ProductItem::class, 'Code', 'FabricCode');
}
}
thanks