dimanche 18 mars 2018

Laravel Query Relationship in 3 tables using eloquent

Help me again,

I have 3 tables

Product Table
id
product_name


Productquantity Table
id
prod_id -> product table id
price

Purchaserecord
id
prodquantityid -> productquantity table id
quantity
amount

How can I make to display the name of the product in my view? I have this on my Purchaserecord model

public function productquantity()
{
    return $this->belongsTO('App\Productquantity', 'prodquantityid', 'id');
}

and in my view

@foreach($dataPurchaseRecord as $Record)
<tr>
<td></td>
<td></td>
<td></td>
</tr>
@endforeach 

I just want to know how to display the product name instead of the productid

Thank you



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2IAX9cb
via IFTTT

Aucun commentaire:

Enregistrer un commentaire