<?php

namespace App\Models;

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

class Province extends Model
{
    use HasFactory;
    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'feature_id',
        //'center_lat',
        //'center_long',
        'created_at',
        'updated_at'
    ];

    public function abrarPlanProjects()
    {
        return $this->hasMany('App\Models\AbrarPlanProject');
    }

    public function users()
    {
        return $this->hasMany('App\Models\User');
    }

    /**
     * Get all of the projects for the province.
     */
    public function roadConstructionProjects()
    {
        return $this->hasManyThrough('App\Models\RoadConstructionProject', 'App\Models\User');
    }

    /**
     * Get all of the projects for the province.
     */
    public function roadItemsProjects()
    {
        return $this->hasManyThrough('App\Models\RoadItemsProject', 'App\Models\User');
    }

    /**
     * Get all of the projects for the province.
     */
    public function roadPatrolProjects()
    {
        return $this->hasManyThrough('App\Models\RoadPatrolProject', 'App\Models\User');
    }

    public function jaheshOperation()
    {
        return $this->hasOne('App\Models\JaheshOperation');
    }

    /**
     * Get all of the projects for the province.
     */
    public function roadMaintenanceProjects()
    {
        return $this->hasMany('App\Models\RoadMaintenanceProject');
    }

    public function fastReactionProjects()
    {
        return $this->hasMany('App\Models\RoadObserved', 'rms_province_id');
    }
    public function roadConstructionRural()
    {
        return $this->hasMany('App\Models\RoadConstructionRural');
    }
}
