<?php

namespace App\Models;

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

class Stock_take extends Model
{
    use HasFactory;
    protected $guarded = [];

    public function plants()
    {
        return $this->belongsTo(Plant::class, 'plant_code', 'plant_code');
    }

    public function locations()
    {
        return $this->belongsTo(Location::class, 'storage_location_code', 'storage_location_code');
    }

    public function stock_counts()
    {
        return $this->hasMany(Stock_take_material::class);
    }

    public function users()
    {
        return $this->belongsToMany(User::class);
    }

    public function clerks()
    {
        return $this->hasMany(Location_clerks::class);
    }
}