<?php

namespace App\Models;

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

class Armazen extends Model
{
    use HasFactory;
    protected $table='armazens';
    protected $fillable = [
        'nomearmazem',
        'descricaoarmazem',
        'alturaarmazem',
        'numerocorredores',
        'numeroandares',
        'larguraarmazem',
        'usuario_id',
        'base_id',
    ];
    protected $dates = ['deleted_at'];
    
    public  function getUsersArmazem(){

        return $this->belongsTo(related: User::class,foreignKey: 'usuario_id',ownerKey:'id');
    }
    public  function getBaseArmazem(){

        return $this->belongsTo(related: Base_GestDoc::class, foreignKey: 'usuario_id',ownerKey:'id');
    }
    public function getcorredores(){
        return $this->hasMany(related:Corredor::class, foreignKey:'armaezem_id', localKey:'id');
    }


}
