/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $berangkat = \App\berangkat::find($id); $data = []; $rute = \App\rute::where('sjt', '=', $id)->get(); $i = 0; foreach ($rute as $rt) { $resi = \App\resi::where('idberangkat', $rt->sjt)->where('idrute', $rt->id)->get(); $data[$i]['rute'] = $rt; $data[$i]['resi'] = $resi; $i++; } return view('admin.transaction.keberangkatan-detail')->with('berangkat', $berangkat)->with('data', $data); }
$table .= '<tbody>'; foreach ($resi as $r) { $table .= '<tr><td>' . $r->tglresi . '</td>'; $table .= '<td>' . $r->noresi . '</td>'; $table .= '<td>' . $r->totqty . '</td>'; $table .= '<td>' . $r->idkonsumen . '</td>'; $table .= '<td>' . $r->idpenerima . '</td>'; $table .= '<td>' . $r->totalbiaya . '</td>'; $table .= '<td>' . $r->dp . '</td>'; $table .= '<td>' . $r->sisa . '</td></tr>'; } $table .= '</tbody>'; $table .= '</table>'; return $table; }); Route::get('go', function () { return view('test.test1'); }); Route::get('go2/{id}', function ($id) { $berangkat = \App\berangkat::find($id); $data = []; $rute = \App\rute::where('sjt', '=', $id)->get(); $i = 0; foreach ($rute as $rt) { $resi = \App\resi::where('idberangkat', $rt->sjt)->where('idrute', $rt->id)->get(); $data[$i]['rute'] = $rt; $data[$i]['resi'] = $resi; $i++; } return view('test.test2')->with('data', $data)->with('berangkat', $berangkat); });