<?php

namespace App\Models;

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

class SerialNumber extends Model
{
    use HasFactory, SoftDeletes;

    protected $table = 'sn_batches';

    protected $fillable = ['item_reference_id', 'reference_number', 'item_number', 'variant_code',
    'description', 'user_id', 'qty','status','closed_at'];

    public function details() {
        return $this->hasMany(SerialNumberDetail::class, 'sn_batch_id', 'id');
    }

    public function user() {
        return $this->belongsTo(User::class);
    }
}
