<?php

namespace App\Models;

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

class Months_covered extends Model
{
    use HasFactory, SoftDeletes;

    /**
     * The attributes that are mass assignable.
     */
    protected $fillable = [
        'cover_id',    // ✅ Allow mass assignment for cover_id
        'months',
        'payment_id',
        'member_id',
    ];

    /**
     * Relationships
     */
    public function payment()
    {
        return $this->belongsTo(Premium_payment::class, 'payment_id');
    }

    public function premiumPayment()
    {
        return $this->belongsTo(Premium_payment::class, 'payment_id');
    }

    public function member()
    {
        return $this->belongsTo(Member::class, 'member_id');
    }

    public function cover()
    {
        return $this->belongsTo(Cover::class, 'cover_id');
    }
}
