public function editcountry() { $err = array(); if ($_POST['_type'] == 3) { $model_country = model_ext_country::find($_POST['country_code']); $model_country->delete(); } else { if ($_POST['_type'] == 1) { $model_country = new model_ext_country(); $model_country->create($_POST); } else { if ($_POST['_type'] == 2) { $model_country = model_ext_country::find($_POST['country_code_old']); unset($_POST['country_code_old']); $model_country->fill($_POST); $model_country->save(); } } } return redirect('/backend/country')->withErrors($err); }
public function getProv() { $country_id = $_POST['country_id']; $model_country = model_ext_country::find($country_id); echo json_encode($model_country->province); }