<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * 料金・容量モデル - price_aテーブル（正式モデル）
 * 旧UsingStatusPriceの責務を置き換え
 */
class PriceA extends Model
{
    protected $table = 'price_a';
    protected $primaryKey = 'price_parkplaceid';
    public $timestamps = true;

    public const CREATED_AT = 'created_at';
    public const UPDATED_AT = 'updated_at';

    protected $fillable = [
        'prine_name',
        'price_month',
        'park_id',
        'psection_id',
        'price_ptypeid',
        'user_categoryid',
        'pplace_id',
        'park_number',
        'park_standard',
        'park_limit',
        'price',
        'operator_id',
    ];

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

    /**
     * 車種分類
     */
    public function ptype()
    {
        return $this->belongsTo(Ptype::class, 'price_ptypeid', 'ptype_id');
    }

    /**
     * 定期契約
     */
    public function contracts()
    {
        return $this->hasMany(RegularContract::class, 'price_parkplaceid', 'price_parkplaceid');
    }
}




