PDF reading with python
This commit is contained in:
@ -6,6 +6,7 @@ use ProVM\Common\Alias\Model;
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $nombre
|
||||
* @property TipoCategoria $tipo_id
|
||||
*/
|
||||
class Categoria extends Model {
|
||||
public static $_table = 'categorias';
|
||||
@ -18,6 +19,13 @@ class Categoria extends Model {
|
||||
}
|
||||
return $this->cuentas;
|
||||
}
|
||||
protected $tipo;
|
||||
public function tipo() {
|
||||
if ($this->tipo === null) {
|
||||
$this->tipo = $this->childOf(TipoCategoria::class, [Model::SELF_KEY => 'tipo_id']);
|
||||
}
|
||||
return $this->tipo;
|
||||
}
|
||||
|
||||
protected $saldo;
|
||||
public function saldo() {
|
||||
@ -34,6 +42,7 @@ class Categoria extends Model {
|
||||
|
||||
public function toArray(): array {
|
||||
$arr = parent::toArray();
|
||||
$arr['tipo'] = $this->tipo()->toArray();
|
||||
$arr['saldo'] = $this->saldo();
|
||||
$arr['saldoFormateado'] = '$' . number_format($this->saldo(), 0, ',', '.');
|
||||
return $arr;
|
||||
|
Reference in New Issue
Block a user