<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Checkout extends Model
{
    protected $table = 'checkout';

    protected $primaryKey = 'checkout_id';

    protected $fillable = [
    'bidder_num',
    'winnertotal',
    'payment_method',
    'check_number',
    'cc_transaction',
    'cc_amount',
    'created_at',
    'updated_at'
    ];

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

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

    public function paymentMethod()
    {
        return $this->hasMany(PaymentMethods::class, 'pm_id', 'payment_method');
    }
}
