mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
42 lines
1.2 KiB
PHP
Executable File
42 lines
1.2 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Models\Facturas;
|
|
|
|
class FacturaPagoModel extends \App\Models\BaseModel {
|
|
|
|
protected $table = 'facturas_pagos';
|
|
|
|
protected $allowedFields = [
|
|
'factura_id',
|
|
'notes',
|
|
'fecha_pago_at',
|
|
'fecha_vencimiento_at',
|
|
'forma_pago_id',
|
|
'total',
|
|
'deleted_at',
|
|
'user_updated_id'
|
|
];
|
|
|
|
protected $returnType = "App\Entities\Facturas\FacturaPagoEntity";
|
|
|
|
protected $useTimestamps = false;
|
|
protected $useSoftDeletes = true;
|
|
|
|
public static $labelField = "id";
|
|
|
|
public function getResource($factura_id)
|
|
{
|
|
$builder = $this->db
|
|
->table($this->table . " t1")
|
|
->select(
|
|
"t1.id AS id, t1.factura_id AS factura_id,
|
|
t1.notes AS notes, t1.fecha_pago_at AS fecha_pago_at, t1.fecha_vencimiento_at AS fecha_vencimiento_at,
|
|
t1.forma_pago_id AS forma_pago_id, t2.nombre as forma_pago, t1.total AS total"
|
|
)
|
|
->join("formas_pago t2", "t2.id = t1.forma_pago_id", "left")
|
|
->where("t1.factura_id", $factura_id)
|
|
->where("t1.deleted_at", null);
|
|
|
|
return $builder;
|
|
}
|
|
} |