<?php

namespace App\Models;

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

class Corredor extends Model
{
    use HasFactory;
    use SoftDeletes;
    protected $dates = ['deleted_at'];
    protected $table="corredores";
    protected $fillable = ['numerocorredor','configuracao_id','armazem_id','quantidadedemodulos','usuario_id'];



    public function getLados(){

        return $this->hasMany(related:Corredor::class,foreignKey:'armazem_id',localKey:'id' );
    }
    public function getArmazem(){
        return $this->belongsTo(related:ArmazemModel::class, foreignKey:'armazem_id', ownerKey:'id');
    }
    public function getConfiguracao(){
        return $this->belongsTo(related:ConfiguracaoCorredor::class, foreignKey:'configuracao_id', ownerKey:'id');
    }
    public function getLados_corredores(){

        return $this->hasMany(LadoCorredor::class);
    }
    public function getAndar_corredores(){

        return $this->belongsTo(Anda::class,'andar_id','id');
    }
}
