<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class AbrarPlanProject extends Model
{
    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'province_id',
        'city_id',
        'created_at',
        'updated_at'
    ];

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [
        'project_type' => 'array',
        'project_start_latlng' => 'array',
        'project_end_latlng' => 'array'
    ];

    /**
     * Get all of the project's files.
     */
    public function files()
    {
        return $this->morphMany('App\Models\ProjectFile', 'project_fileable');
    }

    public function projectHistories()
    {
        return $this->hasMany('App\Models\AbrarPlanProjectHistory', 'project_id');
    }

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