public function readSelectlistForDisplayInGrid() { $carsubmodelids = Car::distinct()->lists('carsubmodelid'); $carsubmodels = CarSubModel::whereIn('id', $carsubmodelids)->orderBy('name', 'asc')->get(['id', 'name']); $carsubmodelselectlist = array(); array_push($carsubmodelselectlist, ':เลือกรุ่น'); foreach ($carsubmodels as $item) { array_push($carsubmodelselectlist, $item->id . ':' . $item->name); } $colorids = Car::distinct()->lists('colorid'); $colors = Color::whereIn('id', $colorids)->orderBy('code', 'asc')->get(['id', 'code', 'name']); $colorselectlist = array(); array_push($colorselectlist, ':เลือกสี'); foreach ($colors as $item) { array_push($colorselectlist, $item->id . ':' . $item->code . ' - ' . $item->name); } return ['carsubmodelselectlist' => implode(";", $carsubmodelselectlist), 'colorselectlist' => implode(";", $colorselectlist)]; }