<?php

namespace App\Models;

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

class BarangRusak extends Model
{
    use HasFactory;

    protected $table = 'barang_rusak';

    protected $fillable = [
        'user_id',
        'tanggal',
        'lokasi',
        'kerusakan',
        'keterangan',
        'status',
        'admin_note',
    ];

    protected $casts = [
        'kerusakan' => 'array',
        'tanggal' => 'date',
    ];

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