"t1.id", 1 => "t1.updated_at", 2 => "t1.fecha_entrega_real", 3 => "t4.nombre", 4 => "t5.first_name", 5 => "t3.titulo", 6 => "t6.ubicacion", 7 => "t3.inc_rei", 8 => "t3.paginas", 9 => "t3.tirada", 10 => "t3.total_aceptado", 11 => "t1.estado" ]; protected $allowedFields = [ "total_precio", "total_tirada", "estado", "user_created_id", "user_updated_id", "user_validated_id", "fecha_entrega_real", "fecha_impresion", "fecha_encuadernado", "fecha_entrega_externo", "created_at", "updated_at", "validated_at", ]; protected $returnType = "App\Entities\Pedidos\PedidoEntity"; protected $useTimestamps = true; protected $useSoftDeletes = false; protected $createdField = "created_at"; protected $updatedField = "updated_at"; public static $labelField = "id"; public function obtenerDatosForm($pedido_id){ $builder = $this->db ->table($this->table . " t1") ->select( "t4.id AS cliente_id, t4.nombre AS cliente, CONCAT(t5.first_name, ' ', t5.last_name) AS comercial"); $builder->join("pedidos_linea t2", "t2.pedido_id = t1.id", "left"); $builder->join("presupuestos t3", "t2.presupuesto_id = t3.id", "left"); $builder->join("clientes t4", "t4.id = t3.cliente_id", "left"); $builder->join("users t5", "t5.id = t4.comercial_id", "left"); return $builder->get()->getResultObject(); } }