public function GetWard($districtid)
 {
     $ward = Ward::select(["wardid", "name"])->where("districtid", $districtid)->orderBy("name")->get();
     $string = "";
     foreach ($ward as $w) {
         $string .= "<option value='" . $w->wardid . "'>" . $w->name . "</option>";
     }
     return json_encode(["ward" => $string]);
 }
 public function Address()
 {
     if (Auth::check()) {
         $customerId = Auth::user()->id;
         $province = Province::select(["provinceid", "name"])->orderBy("name")->get();
         $district = District::select(["districtid", "name"])->where("provinceid", $province[0]->provinceid)->orderBy("name")->get();
         $ward = Ward::select(["wardid", "name"])->where("districtid", $district[0]->districtid)->orderBy("name")->get();
         $address = CustomerInfo::getAllAddressInfo($customerId);
         return view("pages.paymentInfo.address", compact("province", "district", "ward", "address"));
     } else {
         return redirect()->route("login");
     }
 }
 public function CustomerInfo()
 {
     if (Request::ajax()) {
         if (Auth::check()) {
             $customerId = Auth::user()->id;
             $province = Province::select(["provinceid", "name"])->orderBy("name")->get();
             $district = District::select(["districtid", "name"])->where("provinceid", $province[0]->provinceid)->orderBy("name")->get();
             $ward = Ward::select(["wardid", "name"])->where("districtid", $district[0]->districtid)->orderBy("name")->get();
             $address = CustomerInfo::getAllAddressInfo($customerId);
             //danh sach dia chi
             return view("pages.customerInfo.info", compact("province", "district", "ward", "address"));
         }
     } else {
         return redirect()->route("home");
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $wards = Ward::select(array('id', 'name', 'created_at'));
     return \Datatables::of($wards)->addColumn('actions', '<a class="btn btn-xs btn-alt" data-toggle="modal" onClick="launchUpdateWardModal({{$id}});" data-target=".modalEditWard">Edit</a>')->make(true);
 }