protected function onGet(\Controllers\Request $input) { $id = $this->input->get('id'); $this->data['soil_type'] = Soil::find($id); if (!$this->data['soil_type']) { return $this->redirect($this->plugin->soil_url()); } return parent::onGet($input); }
private function _expandInput($input) { $result = ['modules' => [], 'soils' => []]; $soilById = Soil::byId(Soil::all()); $perimeters = array_get($input, 'soils', []); foreach ($perimeters as $poly) { $polygon = new Polygon($poly['p']); $soil = array_get($soilById, array_get($poly, 's', ''), new Soil()); $result['soils'][] = ['polygon' => $polygon, 'soil' => $soil]; } return $result; }
protected function onGet(\Controllers\Request $input) { $this->data['soil_types'] = Soil::all(); return parent::onGet($input); }
protected function onGet(\Illuminate\Http\Request $input) { $this->data['soil_types'] = Soil::orderBy('name')->paginate(25, ['*'], 'subpage'); return parent::onGet($input); }