<?php

namespace App\Models\Site;

use App\Models\City;
use App\Models\District;
use App\Models\Street;
use App\Models\Town;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class NeedHome extends Model
{
    use HasFactory;

    public function getCity(){
        return $this->hasOne(City::class,'il_id','city_id');
    }

    public function getTown(){
        return $this->hasOne(Town::class,'ilce_id','town_id');
    }

    public function getDistrict(){
        return $this->hasOne(District::class,'mahalle_id','district_id');
    }

    public function getStreet(){
        return $this->hasOne(Street::class,'sokak_id','street_id');
    }

    public function getPersons(){
        return $this->hasMany(NeedHomePerson::class,'need_home_id','id');
    }
}
