Таблица:
[code]ref_code_exam[/code]
< tr>
идентификатор
описание
1
Экзамен 1
2
Экзамен 2
3
Экзамен 3
[code]ref_appointment[/code]
< tr>
id
registry_id
type_of_exam_id
1
10
2
2
11
["1","2","3"]
Код в моем контроллере:
Код: Выделить всё
$data = $this->data();
$array = array();
foreach ($data as $v) {
$apptype1[] = $v->type_of_exam_id
$array[$v->id] = array(
'type_of_app' => array()
);
$type_of_app = DB::table('ref_code_exam')
->wherein('id', $apptype1)
->get();
foreach ($type_of_app as $k) {
array_push($array[$v->id]['type_of_app'], $k->description);
}
}
return view('transactions.pendapp', ['data' => $data, 'apptype1' => $array])
->with('i', (request()->input('page', 1) -1) * 10);
Код: Выделить всё
@foreach($data as $students)
{{ ++$i }}
{{ $students->applicant_no }}
{{ $students->stud_fname }}
{{ $students->stud_mname }}
{{ $students->stud_lname }}
{{-- {{ $students->description}} --}}
@foreach ($apptype1[$students->id] as $v)
@for ($m = 0; $m < count($v); $m++)
[*]{{ $v[$m] }}
@endfor
@endforeach
Подробнее здесь: https://stackoverflow.com/questions/766 ... ence-table