<?php

namespace App\Models;

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

class Invoice extends Model
{
    use HasFactory;

    protected $fillable = [
        'student_id',
        'invoice_no',
        'total_amount',
        'paid_amount',
        'due_amount',
        'month',
        'year',
        'status'
    ];

    // একজন ছাত্রের একটি ইনভয়েস থাকে
    public function student()
    {
        return $this->belongsTo(Student::class, 'student_id');
    }

    // একটি ইনভয়েসের অনেকগুলো আইটেম (Fees) থাকতে পারে
    public function items()
    {
        return $this->hasMany(InvoiceItem::class, 'invoice_id');
    }
}