mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
add method to get relations
This commit is contained in:
@ -4,7 +4,9 @@ namespace App\Entities\Configuracion;
|
||||
use App\Models\Configuracion\MaquinasCallesModel;
|
||||
use App\Models\Configuracion\MaquinasDefectoModel;
|
||||
use App\Models\Configuracion\MaquinasPapelesImpresionModel;
|
||||
use App\Models\Configuracion\MaquinasTarifasImpresionModel;
|
||||
use CodeIgniter\Entity;
|
||||
use PhpParser\Node\Expr\Cast\Array_;
|
||||
|
||||
class Maquina extends \CodeIgniter\Entity\Entity
|
||||
{
|
||||
@ -83,11 +85,18 @@ class Maquina extends \CodeIgniter\Entity\Entity
|
||||
$m = model(MaquinasCallesModel::class);
|
||||
return $m->asArray()->where('maquina_id',$this->attributes['id'])->findAll();
|
||||
}
|
||||
public function tarifas_impresion() : ?array
|
||||
{
|
||||
$m = model(MaquinasTarifasImpresionModel::class);
|
||||
return $m->asArray()->where('maquina_id',$this->attributes['id'])->findAll();
|
||||
}
|
||||
public function withAll() : self
|
||||
{
|
||||
$this->attributes['papeles_impresion'] = $this->papeles_impresion();
|
||||
$this->attributes['maquina_calles'] = $this->maquina_calles();
|
||||
$this->attributes['maquina_defecto'] = $this->maquina_defecto();
|
||||
$this->attributes['tarifas_impresion'] = $this->tarifas_impresion();
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user