<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class WinningBids extends Model
{
    protected $table = 'winning_bids';

    protected $primaryKey = 'idwinning_bids';

    protected $fillable = [
    'winning_bidder_num',
    'winning_cost',
    'winning_item_num',
    'created_at',
    'updated_at'
    ];

    protected function casts(): array
    {
        return [
            'created_at' => 'datetime',
            'updated_at' => 'datetime',
        ];
    }

    public function items()
    {
        return $this->belongsTo(Items::class, 'winning_item_num', 'iditems');
    }

    public function bidders()
    {
        return $this->belongsTo(Bidders::class, 'winning_bidder_num', 'idbidders');
    }
}
