MINI MINI MANI MO

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

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Spatie\Searchable\Searchable;
use Spatie\Searchable\SearchResult;

class CddSesiones extends Model implements Searchable
{
    use HasFactory;

    protected $table = "cdd_sesiones";
    protected $guarded = ["id"];
    public $timestamps = false;

    public function asistencias()
    {
        return $this->hasMany(CddAsistencia::class, "id_sesion", "id");
    }

    public function asistencia()
    {
        return $this->hasMany(CddAsistencia::class, "id_sesion")->where("asistencia", "=", 1);
    }

    public function inasistencia()
    {
        return $this->hasMany(CddAsistencia::class, "id_sesion")->where("asistencia", "=", 2);
    }

    public function justificante()
    {
        return $this->hasMany(CddAsistencia::class, "id_sesion")->where("asistencia", "=", 3);
    }

    public function getSearchResult(): SearchResult
    {
        return new SearchResult($this, $this->nombre, route('index', $this->id));
    }
    public function regime()
    {
        return $this->belongsTo(TipoRegimen::class,"regimen","id");
    }
    public function period()
    {
        return $this->belongsTo(TipoPeriodo::class,"periodo","id");
    }
}

OHA YOOOO