<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class JurisdictionParking extends Model
{
    // テーブル名を複数形に統一
    protected $table = 'jurisdiction_parking';

    // 主キー
    protected $primaryKey = 'jurisdiction_parking_id';

    // 可変項目
    protected $fillable = [
        'jurisdiction_parking_name',
        'ope_id',
        'park_id',
        'operator_id',
    ];

    public $timestamps = true;

    // リレーション
    public function operator()
    {
        return $this->belongsTo(User::class, 'operator_id');
    }

    public function park()
    {
        return $this->belongsTo(Park::class, 'park_id');
    }

    public function ope()
    {
        return $this->belongsTo(Ope::class, 'ope_id');
    }
}
