<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class RoadPatrolSubProject extends Model
{
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'project_lat', 
        'project_lng', 
        'item', 
        'sub_items', 
        'sub_items_data'
    ];

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

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

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