50 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Models;
 | |
| 
 | |
| use Illuminate\Database\Eloquent\Model;
 | |
| use Illuminate\Support\Facades\DB;
 | |
| 
 | |
| class Region extends Model
 | |
| {
 | |
|     public static function listProv()
 | |
|     {
 | |
|         return DB::select("SELECT * FROM t_region GROUP BY kodeProv;");
 | |
|     }
 | |
| 
 | |
|     public static function getLikeProv($prname)
 | |
|     {
 | |
|         return DB::select("SELECT * FROM t_region WHERE nmProvinsiKel LIKE ? GROUP BY kodeProv;", ['%'.$prname.'%']);
 | |
|     }
 | |
| 
 | |
| 	public static function listCity($kodeProv)
 | |
|     {
 | |
|         return DB::select("SELECT * FROM t_region WHERE kodeProv = ? GROUP BY kodeKab;", [$kodeProv]);
 | |
|     }
 | |
| 
 | |
|     public static function getLikeCity($ktname)
 | |
|     {
 | |
|         return DB::select("SELECT * FROM t_region WHERE nmKotamadyaKel LIKE ? GROUP BY kodeKab;", ['%'.$ktname.'%']);
 | |
|     }
 | |
| 
 | |
| 	public static function listDistrict($kodeKab)
 | |
|     {
 | |
|         return DB::select("SELECT * FROM t_region WHERE kodeKab = ? GROUP BY kodeKec;", [$kodeKab]);
 | |
|     }
 | |
| 
 | |
|     public static function getLikeDistrict($kcname)
 | |
|     {
 | |
|         return DB::select("SELECT * FROM t_region WHERE nmKecamatanKel LIKE ? GROUP BY kodeKec;", ['%'.$kcname.'%']);
 | |
|     }
 | |
| 
 | |
| 	public static function listVillage($kodeKec)
 | |
|     {
 | |
|         return DB::select("SELECT * FROM t_region WHERE kodeKec = ? GROUP BY kodeKel;", [$kodeKec]);
 | |
|     }
 | |
| 
 | |
|     public static function getLikeVillage($klname)
 | |
|     {
 | |
|         return DB::select("SELECT * FROM t_region WHERE nmKelurahan LIKE ? GROUP BY kodeKel;", ['%'.$klname.'%']);
 | |
|     }
 | |
| }
 | 
