mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
añadidos los ficheros de Ozar para maquinas por defecto
This commit is contained in:
118
ci4/app/Models/Configuracion/MaquinaDefectoModel.php
Normal file
118
ci4/app/Models/Configuracion/MaquinaDefectoModel.php
Normal file
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
namespace App\Models\Configuracion;
|
||||
|
||||
class MaquinaDefectoModel extends \App\Models\GoBaseModel
|
||||
{
|
||||
protected $table = "lg_maquina_por_defecto";
|
||||
|
||||
/**
|
||||
* Whether primary key uses auto increment.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
protected $allowedFields = [
|
||||
"tipo",
|
||||
"ancho_min",
|
||||
"ancho_max",
|
||||
"alto_min",
|
||||
"alto_max",
|
||||
"tirada_min",
|
||||
"tirada_max",
|
||||
"maquina_id",
|
||||
];
|
||||
protected $returnType = "App\Entities\Configuracion\MaquinaDefectoEntity";
|
||||
|
||||
protected $useTimestamps = true;
|
||||
protected $useSoftDeletes = false;
|
||||
|
||||
protected $createdField = "created_at";
|
||||
|
||||
protected $updatedField = "updated_at";
|
||||
|
||||
public static $labelField = "tipo";
|
||||
|
||||
protected $validationRules = [
|
||||
"alto_max" => [
|
||||
"label" => "MaquinaPorDefectoes.altoMax",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"alto_min" => [
|
||||
"label" => "MaquinaPorDefectoes.altoMin",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"ancho_max" => [
|
||||
"label" => "MaquinaPorDefectoes.anchoMax",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"ancho_min" => [
|
||||
"label" => "MaquinaPorDefectoes.anchoMin",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"tipo" => [
|
||||
"label" => "MaquinaPorDefectoes.tipo",
|
||||
"rules" => "required|in_list[bn,bnhq,color,portada,cubierta,rotativa]",
|
||||
],
|
||||
"tirada_max" => [
|
||||
"label" => "MaquinaPorDefectoes.tiradaMax",
|
||||
"rules" => "required|integer",
|
||||
],
|
||||
"tirada_min" => [
|
||||
"label" => "MaquinaPorDefectoes.tiradaMin",
|
||||
"rules" => "required|integer",
|
||||
],
|
||||
];
|
||||
|
||||
protected $validationMessages = [
|
||||
"alto_max" => [
|
||||
"decimal" => "MaquinaPorDefectoes.validation.alto_max.decimal",
|
||||
"required" => "MaquinaPorDefectoes.validation.alto_max.required",
|
||||
],
|
||||
"alto_min" => [
|
||||
"decimal" => "MaquinaPorDefectoes.validation.alto_min.decimal",
|
||||
"required" => "MaquinaPorDefectoes.validation.alto_min.required",
|
||||
],
|
||||
"ancho_max" => [
|
||||
"decimal" => "MaquinaPorDefectoes.validation.ancho_max.decimal",
|
||||
"required" => "MaquinaPorDefectoes.validation.ancho_max.required",
|
||||
],
|
||||
"ancho_min" => [
|
||||
"decimal" => "MaquinaPorDefectoes.validation.ancho_min.decimal",
|
||||
"required" => "MaquinaPorDefectoes.validation.ancho_min.required",
|
||||
],
|
||||
"tipo" => [
|
||||
"in_list" => "MaquinaPorDefectoes.validation.tipo.in_list",
|
||||
"required" => "MaquinaPorDefectoes.validation.tipo.required",
|
||||
],
|
||||
"tirada_max" => [
|
||||
"integer" => "MaquinaPorDefectoes.validation.tirada_max.integer",
|
||||
"required" => "MaquinaPorDefectoes.validation.tirada_max.required",
|
||||
],
|
||||
"tirada_min" => [
|
||||
"integer" => "MaquinaPorDefectoes.validation.tirada_min.integer",
|
||||
"required" => "MaquinaPorDefectoes.validation.tirada_min.required",
|
||||
],
|
||||
];
|
||||
|
||||
public function findAllWithMaquinas(string $selcols = "*", int $limit = null, int $offset = 0)
|
||||
{
|
||||
$sql =
|
||||
"SELECT t1." .
|
||||
$selcols .
|
||||
", t2.nombre AS maquina FROM " .
|
||||
$this->table .
|
||||
" t1 LEFT JOIN lg_maquinas t2 ON t1.maquina_id = t2.id";
|
||||
if (!is_null($limit) && intval($limit) > 0) {
|
||||
$sql .= " LIMIT " . $limit;
|
||||
}
|
||||
|
||||
if (!is_null($offset) && intval($offset) > 0) {
|
||||
$sql .= " OFFSET " . $offset;
|
||||
}
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
$result = $query->getResultObject();
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user