MINI MINI MANI MO
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Decretos extends Model
{
use HasFactory, SoftDeletes;
protected $table = "decretos";
protected $guarded = ["id"];
public function iniciativa()
{
return $this->hasOne(CddIniciativas::class,"id","id_iniciativa");
}
public function votacionDecreto()
{
return $this->hasMany(VotacionDecretos::class, "id_decretos");
}
public function favor()
{
return $this->hasMany(VotacionDecretos::class, "id_decretos")->where("voto", "=", 1);
}
public function contra()
{
return $this->hasMany(VotacionDecretos::class, "id_decretos")->where("voto", "=", 2);
}
public function abstencion()
{
return $this->hasMany(VotacionDecretos::class, "id_decretos")->where("voto", "=", 3);
}
public function sinRegistro()
{
return $this->hasMany(VotacionDecretos::class, "id_decretos")->where("voto", "=", 4);
}
}
OHA YOOOO