How can I get data(multiple field/get a whole single record) and display it using a foreign key?
Here is the relation in my model
public function getBrand()
return $this->hasOne(ReviewsBrand::className(), ['id' => 'brand_id']);
So in the product table I have brand_id as a column and then in my product brand table id.
For example on the product view I want to use the id, slug and title field from the brands table using foreign key.
u can write in product view, brand.slug, brand.title.
u can refer this ref