<?php

namespace App\Models;

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

class Items extends Model
{
    use HasFactory;

    protected $table = 'items';

    protected $fillable = [
        'name',
        'description',
        'price',
        'image_url', // Tambahkan ini
        'is_available',
        'type_item_id',
    ];

    /**
     * Relasi Many-to-One: Item ini milik satu TypeItem.
     */
    public function typeItem()
    {
        return $this->belongsTo(TypeItems::class, 'type_item_id');
    }

}
