bekaskaki
8 months ago
401
1
Laravel

show data in view from different table

Posted 8 months ago by bekaskaki

i have 3 table

evaluation

id | pks_id | ksb_id | problem | status

pks_id and ksb_id have default value "0"

PKS

id|description|part_1 | part_2 | part_3

KSB

id|description|part_1 | part_2 | part_3

blade view :

@foreach($evaluation as $dt)
<tr>
<td class="text-center"> 
@if($dt->pks_id == '0')
KSB {{ Helper::getDetail('ksb', $dt->ksb_id,'description','id')  }}
@elseif($dt->ksb_id == '0')
PKS {{ Helper::getDetail('pks', $dt->pks_id,'description','id')  }}</td>

<td class="text-center">Part 1</td> // show data pks_id "0" and ksb_id "1" or otherwise

<td class="text-center">Part 2 and 3</td> show data pks_id "0" and ksb_id "1" or otherwise 
</tr>
@endforeach

pks_id and ksb_id will have many value not only one

how to show data in blade view if pks_id "0" and ksb_id "1" or otherwise. part 1, part 2 and part 3 related to pks and ksb table.

i want show data like this

name     |      part        | 

pks test1|  pks1 | pks2,pks3

ksb test1  | ksb1 | ksb2,ksb3

pks test2|  pks1 | pks2,pks3

ksb test2  | ksb1 | ksb2,ksb3

Please sign in or create an account to participate in this conversation.