<?php

namespace App\Models;

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

class PengajuanBarang extends Model
{
    use HasFactory;

    protected $fillable = [
        'ruangan',
        'nama_barang',
        'volume',
        'satuan',
        'harga',
        'jumlah',
        'keterangan',
        'status'
    ];

    protected $casts = [
        'harga' => 'decimal:2',
        'jumlah' => 'decimal:2'
    ];

    public function scopeDiajukan($query)
    {
        return $query->where('status', 'diajukan');
    }

    public function scopeDiterima($query)
    {
        return $query->where('status', 'diterima');
    }

    public function scopeDitolak($query)
    {
        return $query->where('status', 'ditolak');
    }
}
