public function get_editkso($id = false) { if (!$id) { Redirect::to('ksos'); } $kso = Kso::find($id); $optionspool = array(); foreach (Pool::all() as $pool) { $optionspool[$pool->id] = $pool->pool_name; } $opttipe = array(); foreach (Ksotype::all() as $tipe) { $opttipe[$tipe->id] = $tipe->type; } $optionFleet = array(); $optionFleet['null'] = '----'; //$fleets = Fleet::where_pool_id($kso->pool_id)->order_by('taxi_number','asc')->get(array('id','taxi_number')); $fleets = Fleet::order_by('taxi_number', 'asc')->get(array('id', 'taxi_number')); if ($fleets) { foreach ($fleets as $fo) { $optionFleet[$fo->id] = $fo->taxi_number; } } $optionDriver = array(); $optionDriver['null'] = '----'; //$drivers = Driver::where_pool_id($kso->pool_id)->order_by('nip', 'asc')->get(array('id','nip','name')); $drivers = Driver::order_by('nip', 'asc')->get(array('id', 'nip', 'name')); if ($drivers) { foreach ($drivers as $do) { $optionDriver[$do->id] = $do->nip . ' - ' . $do->name; } } $this->data['statuskso'] = array('1' => 'Active', '2' => 'Gugur KSO', '3' => 'Selesai KSO'); $this->data['pools'] = $optionspool; $this->data['kso_types'] = $opttipe; $this->data['datakso'] = $kso; $this->data['fleets'] = $optionFleet; $this->data['drivers'] = $optionDriver; return View::make('themes.modul.' . $this->views . '.formeditkso', $this->data); }
/** * export to excel. * * @return */ public function get_exporttoxls() { $drivers = Driver::order_by('nip', 'asc')->where('pool_id', '=', Auth::user()->pool_id)->get(); return View::make('themes.modul.' . $this->views . '.export', compact('drivers')); }