dimanche 18 mars 2018

Display Data in Laravel Query from another table using model

Help me again.

I have this in my model

public function quantity()
    {
        return $this->hasMany('App\Productquantity', 'prod_id', 'id');
    }

and I want to get the branch name of each product quantity so the productquantity table has field of branch_id.

How can I display the branch name in branch table?

@forelse($Productquantity->quantity as $dataQuantity)
<tr class="item">
<td align="center" style="text-align:center" width="100px"> <a href="#" class="avatar"><img src="/" width="50px"/></a> </td>
<td style="width:100px;"> </td>
<td></td>
<td></td>
<td></td>
<td style="width:100px;" class="td-actions"><a href="javascript:;" class="edit-modal btn btn-mini btn-info" data-id="" ><i class="icon-plus"> </i> Add Stocks</a> </td>
</tr>  

@empty
<tr>
<td colspan="5"> <em>No Data</em></td>
</tr>

@endforelse 

this should be displayed the name instead of the branch Id.. Please help.



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

Aucun commentaire:

Enregistrer un commentaire