52 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
| <?php
 | |
| 
 | |
| namespace App\Models\Master;
 | |
| 
 | |
| use Illuminate\Database\Eloquent\Factories\HasFactory;
 | |
| use Illuminate\Database\Eloquent\Model;
 | |
| 
 | |
| class Sekolah extends Model
 | |
| {
 | |
|     use HasFactory;
 | |
| 
 | |
|     protected $table = 'ms_sekolah';
 | |
|     protected $primaryKey = 'MsSekolahId';
 | |
|     protected $fillable = [
 | |
|         'ms_provinsi_id',
 | |
|         'ms_kabupaten_id',
 | |
|         'ms_kecamatan_id',
 | |
|         'ms_tingkat_sekolah_id',
 | |
|         'status',
 | |
|         'nama_sekolah',
 | |
|         'npsn',
 | |
|         'alamat_sekolah',
 | |
|         'lat',
 | |
|         'long',
 | |
|     ];
 | |
| 
 | |
|     public function profile()
 | |
|     {
 | |
|         return $this->belongsTo(\App\Models\ProfileSekolah::class,'MsSekolahId','ms_sekolah_id');
 | |
|     }
 | |
| 
 | |
|     public function provinsi()
 | |
|     {
 | |
|         return $this->belongsTo(\App\Models\Master\Provinsi::class,'ms_provinsi_id','MsProvinsiId');
 | |
|     }
 | |
| 
 | |
|     public function tingkat()
 | |
|     {
 | |
|         return $this->belongsTo(\App\Models\Master\MasterTingkatSekolah::class,'ms_tingkat_sekolah_id','MsTingkatSekolahId');
 | |
|     }
 | |
| 
 | |
|     public function kabupaten()
 | |
|     {
 | |
|         return $this->belongsTo(\App\Models\Master\Kabupaten::class,'ms_kabupaten_id','MsKabupatenId');
 | |
|     }
 | |
| 
 | |
|     public function kecamatan()
 | |
|     {
 | |
|         return $this->belongsTo(\App\Models\Master\Kecamatan::class,'ms_kecamatan_id','MsKecamatanId');
 | |
|     }
 | |
| }
 |