mirror of
https://gitlab.com/DanLegoff/mgap.git
synced 2026-11-16 14:22:37 +00:00
35 lines
903 B
PHP
35 lines
903 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Traits\LogsAuditoria;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Control extends Model
|
|
{
|
|
use LogsAuditoria;
|
|
|
|
protected $table = 'controles';
|
|
|
|
protected $fillable = ['nombre', 'descripcion', 'estado', 'nivel_de_control', 'fecha_inicio', 'fecha_fin'];
|
|
|
|
protected $casts = [
|
|
'fecha_inicio' => 'datetime',
|
|
'fecha_fin' => 'datetime',
|
|
];
|
|
|
|
public function tiposControles()
|
|
{
|
|
return $this->belongsToMany(TipoControl::class, 'control_tipos_control', 'control_id', 'tipo_control_id')
|
|
->withPivot(['fecha_inicio', 'fecha_fin'])
|
|
->withTimestamps();
|
|
}
|
|
|
|
public function riesgos()
|
|
{
|
|
return $this->belongsToMany(Riesgo::class, 'riesgo_control', 'control_id', 'riesgo_id')
|
|
->withPivot(['id', 'fecha_identificacion', 'fecha_fin'])
|
|
->withTimestamps();
|
|
}
|
|
}
|