<?php
namespace App\Models\Configuracion;

class TipoPresupuestoModel extends \App\Models\GoBaseModel
{
    protected $table = "tipos_presupuestos";

    /**
     * Whether primary key uses auto increment.
     *
     * @var bool
     */
    protected $useAutoIncrement = true;

    protected $allowedFields = ["codigo", "is_cosido", "is_deleted", 'deleted_at', 'updated_at', 'created_at'];
    protected $returnType = "App\Entities\Configuracion\TipoPresupuestoEntity";

    public static $labelField = "codigo";

    
    public function get_isCosido(int $id){

        $builder = $this->db
            ->table($this->table . " t1")
            ->select("t1.is_cosido AS is_cosido")
            ->where('t1.id', $id)
            ->where('t1.is_deleted', 0);

        $result = $builder->get()->getResultObject();
        if(count($result)>0){
            return $result[0]->is_cosido;
        }
        return null;
    }


   
}
