public function senaraiSpeedDial2() { $staff = Staff::where('speedDial', '<>', '0')->where('speedDial', '<>', '')->orderBy('speedDial', 'asc')->get(); $syarikat = Syarikat::where('speedDial', '<>', '')->where('speedDial', '<>', '0')->orderBy('speedDial', 'asc')->get(); $speedDialData[] = ''; foreach ($staff as $staf) { $speedDialData[$staf->speedDial] = ['nama' => $staf->nama, 'bahagian' => $staf->bahagian, 'speedDial' => $staf->speedDial, 'noPhone' => $staf->noPhone]; } foreach ($syarikat as $sykt) { $speedDialData[$sykt->speedDial] = ['nama' => $sykt->nama, 'bahagian' => $sykt->alamat, 'speedDial' => $sykt->speedDial, 'noPhone' => $sykt->noTel]; } echo '<pre>', var_dump($speedDialData), '</pre>'; foreach ($speedDialData as $data) { echo $data->nama; } return 'done'; return View::make('/admin/senarai/speedDial2')->with('title', 'Senarai Speed Dial')->with('data', $speedDialData); }
public function carian2($carian) { if (Request::ajax()) { if ($carian != '') { $users = Syarikat::where('nama', 'like', '%' . $carian . '%')->get(); $count = 1; $output = '<table class="table table-striped table-bordered responsive"> <thead> <tr> <th>Bil</th> <th>Nama</th> <th>No Telefon</th> <th>Sambungan</th> <th>Speed Dial</th> <th>No Faks</th> <th>Alamat</th> <th>Pilihan</th> </tr> </thead> <tbody>'; foreach ($users as $user) { $output .= '<tr> <td>' . $count++ . '</td> <td class="center"><b>' . $user->nama . '</b></td> <td class="center"><b>' . $user->noTel . '<br />' . $user->noTel2 . '<br />' . $user->noTel3 . '</b></td> <td class="center"><b>' . $user->sambungan . '</b></td>'; $speedDial = ''; if (strlen($user->speedDial) < 4) { $speedDial = '# ' . $user->speedDial; } else { $speedDial = $user->speedDial; } $output .= ' <td class="center"><b>' . $speedDial . '</b></td> <td class="center"><b>' . $user->noFaks . '</b></td> <td class="center"><b>' . $user->alamat . '</b></td> <td>[ <a href="' . URL::route('syarikat-delete', array($user->id)) . '">Hapus</a> ] [ <a href="' . URL::route('syarikat-kemaskini', array($user->id)) . '">Kemaskini</a> ]</td> </tr>'; } $output .= ' </tbody> </table>'; if ($users->count() == 0) { $output = '<table class="table table-striped table-bordered responsive"> <thead> <tr> <th>Bil</th> <th>Nama</th> <th>No Telefon</th> <th>Speed Dial</th> <th>No Faks</th> <th>Alamat</th> <th>Pilihan</th> </tr> </thead> <tbody> <tr> <td colspan="7"><font color="red">Tiada Maklumat</font></td> </tr> </tbody> </table>'; } return $output; } else { return ''; } } }
public function carian3($carian) { if (Request::ajax()) { if ($carian != '') { $users = Syarikat::where('nama', 'like', '%' . $carian . '%')->get(); $count = 1; $output = '<table class="table table-striped table-bordered responsive"> <thead> <tr> <th>Bil...</th> <th>Nama</th> <th>No Telefon</th> <th>Speed Dial</th> <th>No Faks</th> <th>Alamat</th> </tr> </thead> <tbody>'; foreach ($users as $user) { $output .= '<tr> <td>' . $count++ . '</td> <td class="center">' . $user->nama . '</td> <td class="center">' . $user->noTel . '<br />' . $user->noTel2 . '<br />' . $user->noTel3 . '</td>'; $speedDial = ''; if (strlen($user->speedDial) < 4) { $speedDial = '# ' . $user->speedDial; } else { $speedDial = $user->speedDial; } $output .= ' <td class="center">' . $speedDial . '</td> <td class="center">' . $user->noFaks . '</td> <td class="center">' . $user->alamat . '</td> </tr>'; } $output .= ' </tbody> </table>'; if ($users->count() == 0) { $output = '<table class="table table-striped table-bordered responsive"> <thead> <tr> <th>Bil</th> <th>Nama</th> <th>No Telefon</th> <th>Speed Dial</th> <th>No Faks</th> <th>Alamat</th> </tr> </thead> <tbody> <tr> <td colspan="6"><font color="red">Tiada Maklumat</font></td> </tr> </tbody> </table>'; } return $output; } else { return ''; } } }