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 index()
 {
     $model_province = model_ext_province::get();
     $model_ext_country = model_ext_country::all()->sortBy('country_name')->pluck('country_name', 'country_code');
     return view('backend.province.index')->with(['model_province' => $model_province, 'model_country' => $model_ext_country]);
 }
 public function getProv()
 {
     $country_id = $_POST['country_id'];
     $model_country = model_ext_country::find($country_id);
     echo json_encode($model_country->province);
 }