<?php

namespace App\Models;

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

class Plant extends Model
{
    use HasFactory;

    protected $table = 'plants';

    protected $primaryKey = 'plant_id';

    public $timestamps = false;

    public function user(){
        return $this->belongsTo(User::class, 'user_id', 'user_id');
    }

    public function companyProjects(){
        return $this->hasMany(CompanyProject::class, 'plant_id', 'plant_id');
    }

    public function units(){
        return $this->hasMany(Unit::class, 'plant_id', 'plant_id');
    }
}
