I have 2 tables, product and promotion. I do not know how I can display the price of both product and promotion(price after discount) based on product_id in blade. In blade i can only display price for promotion using {{$promotion->price}}
Product Table
id - name - price
Promotion Table
id product_id - price - discount
Controller:
$latestProduct = Promotion::orderBy('created_at', 'desc')
->with('product')
->take(20)
->get();
Model:
Product Model
public function promotion() { return $this->hasMany('App\Model\Promotion'); }Promotion Model
public function product() { return $this->belongsTo('App\Model\Product'); }