MINI MINI MANI MO

Path : /var/www/html/sistemas/saplxi/app/Models/
File Upload :
Current File : /var/www/html/sistemas/saplxi/app/Models/Decretos.php

<?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