public function readSelectlistForDisplayInGrid() { if (!$this->hasPermission($this->menuPermissionName)) { return view($this->viewPermissiondeniedName); } $amphurs = Amphur::has('branchs')->orderBy('name', 'asc')->get(['id', 'name']); $amphurselectlist = array(); array_push($amphurselectlist, ':เลือกเขต/อำเภอ'); foreach ($amphurs as $item) { array_push($amphurselectlist, $item->id . ':' . $item->name); } $districts = District::has('branchs')->orderBy('name', 'asc')->get(['id', 'name']); $districtselectlist = array(); array_push($districtselectlist, ':เลือกตำบล/แขวง'); foreach ($districts as $item) { array_push($districtselectlist, $item->id . ':' . $item->name); } $taxamphurs = Amphur::has('taxBranchs')->orderBy('name', 'asc')->get(['id', 'name']); $taxamphurselectlist = array(); array_push($taxamphurselectlist, ':เลือกเขต/อำเภอ'); foreach ($taxamphurs as $item) { array_push($taxamphurselectlist, $item->id . ':' . $item->name); } $taxdistricts = District::has('taxBranchs')->orderBy('name', 'asc')->get(['id', 'name']); $taxdistrictselectlist = array(); array_push($taxdistrictselectlist, ':เลือกตำบล/แขวง'); foreach ($taxdistricts as $item) { array_push($taxdistrictselectlist, $item->id . ':' . $item->name); } return ['amphurselectlist' => implode(";", $amphurselectlist), 'districtselectlist' => implode(";", $districtselectlist), 'taxamphurselectlist' => implode(";", $taxamphurselectlist), 'taxdistrictselectlist' => implode(";", $taxdistrictselectlist)]; }