<?php

namespace App\Models;

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

class Zone extends Model
{
    use HasFactory;

    /**
     * テーブル名
     */
    protected $table = 'zone';

    /**
     * 主キー
     */
    protected $primaryKey = 'zone_id';

    /**
     * タイムスタンプを有効化
     */
    public $timestamps = true;

    /**
     * 一括代入可能なカラム
     */
    protected $fillable = [
        'park_id',
        'park_name',
        'ptype_id',
        'psection_id',
        'zone_name',
        'zone_number',
        'zone_standard',
        'zone_tolerance',
        'zone_sort',
        'delete_flag',
        'ope_id',
        'created_at',
        'updated_at',
    ];
    public function park()
    {
        return $this->belongsTo(Park::class, 'park_id', 'park_id');
    }

    public function ptype()
    {
        return $this->belongsTo(Ptype::class, 'ptype_id', 'ptype_id');
    }
    public function psection()
    {
        return $this->belongsTo(Psection::class, 'psection_id', 'psection_id');
    }


}
