<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class EdarateShahri extends Model
{
    use HasFactory;
    protected $table = 'edarate_shahri';

    public function cities()
    {
        return $this->belongsToMany('App\Models\City', 'edarate_shahri_be_city')->withPivot('is_primary','id');
    }

    public function roadObserved()
    {
        return $this->hasMany(RoadObserved::class);
    }

    public function roadItemsProjects()
    {
        return $this->morphMany(RoadItemsProject::class, 'edarat');
    }

    public function province()
    {
        return $this->belongsTo('App\Models\Province');
    }
}
