In this video we are going to learn about Show Product Attributes On Product Details Page.
So let see how can we Show Product Attributes On Product Details Page.
Go go to the ProductAttribute model and here create a function


public function attributeValues()
{
return $this->hasMany(AttributeValue::class);
}


Now lets open the AttributeValue modal and here create a function for productAttribute


public function productAttribute()
{
return $this->belongsTo(ProductAttribute::class,'product_attribute_id');
}


Now lets open the details-component.blade.php view file
And here lets show the product attributes


<div>
@foreach($product->attributeValues->unique('product_attribute_id') as $av)
<div class="row" style="margin-top: 20px">
<div class="col-xs-2">
<p>{{$av->productAttribute->name}}</p>
</div>
<div class="col-xs-10">
<select class="form-control" style="width: 200px" wire:model="satt.{{$av->productAttribute->name}}">
@foreach($av->productAttribute->attributeValues->where('product_id',$product->id) as $pav)
<option value="{{$pav->value}}">{{$pav->value}}</option>
@endforeach
</select>
</div>
</div>
@endforeach
</div>


Now its done so lets check so switch to the browser and refresh the page
Now lets click on any product
And here you see the product attribute colour and size
Lets check another product
And you can see the attribute
If I check this product here there is no any attribute
So in this way you can Show Product Attributes On Product Details Page.