<?php

namespace App\Models;

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

class CompanyProject extends Model
{
    use HasFactory;
    protected $table = 'company_projects';

    protected $primaryKey = 'company_projects_id';

    public $timestamps = false;

    public function plants(){

        return $this->hasMany(Plant::class,'plant_id', 'plant_id');
    }

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