Files
safekat/ci4/app/Models/Configuracion/FestivoModel.php
2025-04-28 02:03:40 +02:00

73 lines
1.7 KiB
PHP
Executable File

<?php
namespace App\Models\Configuracion;
use App\Entities\Configuracion\FestivoEntity;
use App\Models\BaseModel;
class FestivoModel extends BaseModel
{
protected $table = "festivos";
protected $primaryKey = 'id';
protected $allowedFields = ["date"];
protected $returnType = FestivoEntity::class;
protected $useAutoIncrement = true;
protected $useSoftDeletes = true;
protected $protectFields = true;
protected bool $allowEmptyInserts = false;
protected bool $updateOnlyChanged = true;
protected array $casts = [];
protected array $castHandlers = [];
// Dates
protected $useTimestamps = true;
protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
// Validation
protected $skipValidation = false;
protected $cleanValidationRules = true;
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = [];
protected $afterInsert = [];
protected $beforeUpdate = [];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
protected $validationRules = [
"date" => [
"label" => "Festivos.date",
"rules" => "required|valid_date[Y-m-d]",
],
];
protected $validationMessages = [
"date" => [
"valid_date" => "Validation.valid_date",
],
];
public function isFestivo($date)
{
return $this->where('date',$date)->countAllResults() > 0 ? true : false;
}
}