public function post_searchDriver() { $jsondata = Input::json(); $pool_id = Auth::user()->pool_id; $drivers = Driver::where_pool_id($pool_id)->where('nip', 'LIKE', '%' . $jsondata->nip . '%')->get(array('id', 'nip', 'name')); $driverdata = array_map(function ($object) { return $object->to_array(); }, $drivers); $data['drivers'] = $driverdata; return json_encode($data); }
public function get_getDriver($pool_id = false) { if (!$pool_id) { return false; } $optionDriver = array(); $optionDriver['----'] = 'null'; $drivers = Driver::where_pool_id($pool_id)->order_by('nip', 'asc')->get(array('id', 'nip', 'name')); if ($drivers) { foreach ($drivers as $do) { $optionDriver[$do->nip . ' - ' . $do->name] = $do->id; } } return json_encode($optionDriver); }