<?php

namespace App\Models;

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

class RecordRow extends Model
{
    use HasFactory;

    protected $table = 'records_rows';

    protected $fillable = [
        'record_id',
        'causal_id',
        'course_id',
        'when',
        'amount',
        'vat_id',
        'note',
        'commercial',
        'aliquota_iva',
        'imponibile',
        'imposta',
        'divisa',
        'quantita',
        'numero_linea',
        'sconto',
        'prediscount_amount',
        'subscription_id',
    ];

    public function causal()
    {
        return $this->belongsTo(Causal::class);
    }

    public function course()
    {
        return $this->belongsTo(Course::class);
    }

    public function subscription()
    {
        return $this->belongsTo(Subscription::class);
    }
}

