mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
send direct message to client users from presupuesto,facturas or pedido forms
This commit is contained in:
@ -1,6 +1,10 @@
|
||||
<?php
|
||||
namespace App\Entities\Pedidos;
|
||||
|
||||
use App\Entities\Clientes\ClienteEntity;
|
||||
use App\Models\Clientes\ClienteModel;
|
||||
use App\Models\Pedidos\PedidoLineaModel;
|
||||
use App\Models\Presupuestos\PresupuestoModel;
|
||||
use CodeIgniter\Entity;
|
||||
|
||||
class PedidoEntity extends \CodeIgniter\Entity\Entity
|
||||
@ -27,4 +31,14 @@ class PedidoEntity extends \CodeIgniter\Entity\Entity
|
||||
"total_precio" => "float",
|
||||
"total_tirada" => "float",
|
||||
];
|
||||
|
||||
public function cliente() : ?ClienteEntity
|
||||
{
|
||||
$m = model(ClienteModel::class);
|
||||
$pl = model(PedidoLineaModel::class);
|
||||
$pm = model(PresupuestoModel::class);
|
||||
$pedido_linea = $pl->where('pedido_id',$this->attributes["id"])->first();
|
||||
$pre = $pm->find($pedido_linea->presupuesto_id);
|
||||
return $m->find($pre->cliente_id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user