<?php

namespace App;

use Illuminate\Database\Eloquent\Model;


class ProjectModel extends Model
{
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $table = "nso007_project_stock";
	
	
	public function get_province()
    {
        return $this->belongsTo('App\ProvinceModel','p_province','province_id');
    }
     public function get_district()
    {
        return $this->belongsTo('App\DistrictModel','p_district','district_id');
    }
    public function get_commune()
    {
        return $this->belongsTo('App\CommuneModel','p_commune','commune_id');
    }
    public function get_village()
    {
        return $this->belongsTo('App\VillageModel','p_village','village_id');
    }

    //SoK Address Extrac
    public function provices(){
        return $this->hasOne('App\ProvinceModel','province_id','p_province');
    }

    public function districts(){
        return $this->hasOne('App\DistrictModel','district_id','p_district');
    }

    public function communes(){
        return $this->hasOne('App\CommuneModel','commune_id','p_commune');
    }

    public function villages(){
        return $this->hasOne('App\VillageModel','village_id','p_village');
    }
}
