<?php

namespace App\Modelos;

use Core\Database;

class Sucursal extends Database
{
    protected $table    = 'app_sucursales';
    protected $id       = 'su_id';

    public function verSucursal($id_sucursal)
    {
        return $this->consultar("SELECT * FROM app_sucursales  WHERE su_id = $id_sucursal")->row();
    }

    public function comprobarSucursalesDiferente($condicion)
    {
        return $this->consultar("SELECT * FROM app_sucursales WHERE $condicion")->all();
    }

    public function chequerForanea($id_sucursal)
    {
        return $this->consultar("SELECT * 
        FROM app_sucursales su
        JOIN app_series se ON su.su_id = se.ser_sucursal
        WHERE su.su_id=$id_sucursal")->row();
    }
}
