<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Accident251Point extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'accident_251_points';

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'lat', 
        'lng', 
        'province',
        'axis_name',
        'axis_start', 
        'axis_end', 
        'native_name',
        'operation',
        'target',
        'cost',
        'progress',
        'end_date',
        'actions'
    ];

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

    public function accident251PointsHistories()
    {
        return $this->hasMany('App\Models\Accident251PointsHistory', 'point_id');
    }

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