mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
update with ot files
This commit is contained in:
@ -6,6 +6,7 @@ use App\Controllers\Produccion\Ordentrabajo;
|
||||
use App\Database\Migrations\OrdenTrabajoDatesTable;
|
||||
use App\Entities\Pedidos\PedidoEntity;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoDate;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoFileModel;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoTarea;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoUser;
|
||||
use App\Models\Pedidos\PedidoModel;
|
||||
@ -109,4 +110,9 @@ class OrdenTrabajoEntity extends Entity
|
||||
$barcodeData = $barcode->getBarcode($this->pedido()->presupuesto()->id);
|
||||
return base64_encode($renderer->render($barcodeData,200, 50));
|
||||
}
|
||||
public function files() : array
|
||||
{
|
||||
$m = model(OrdenTrabajoFileModel::class);
|
||||
return $m->where('orden_trabajo_id',$this->attributes['id'])->findAll() ?? [];
|
||||
}
|
||||
}
|
||||
|
||||
32
ci4/app/Entities/Produccion/OrdenTrabajoFileEntity.php
Normal file
32
ci4/app/Entities/Produccion/OrdenTrabajoFileEntity.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Produccion;
|
||||
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoModel;
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
class OrdenTrabajoFileEntity extends Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"orden_trabajo_id" => null,
|
||||
"name" => null,
|
||||
"upload_by" => null,
|
||||
"file_path" => null
|
||||
];
|
||||
protected $casts = [
|
||||
"orden_trabajo_id" => "integer",
|
||||
"name" => "string",
|
||||
"upload_by" => "integer",
|
||||
"file_path" => "string"
|
||||
];
|
||||
|
||||
public function orden_trabajo(): ?OrdenTrabajoEntity
|
||||
{
|
||||
$m = model(OrdenTrabajoModel::class);
|
||||
return $m->find($this->attributes["orden_trabajo_id"]);
|
||||
}
|
||||
public function hash(): string
|
||||
{
|
||||
return array_reverse(explode('/', $this->attributes["file_path"]))[0];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user