<?php

namespace Kylin\Catering\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;

/**
 * 供应商
 */
class Supplier extends Model
{
    protected $table = 'catering_suppliers';

    protected $fillable = [
        'name',
        'contact',
        'phone',
        'address',
        'license_number',
        'license_expiry',
        'status',
    ];

    protected $casts = [
        'license_expiry' => 'date',
    ];

    public function stocks(): HasMany
    {
        return $this->hasMany(Stock::class);
    }

    public function inspectionRecords(): HasMany
    {
        return $this->hasMany(InspectionRecord::class);
    }
}
