<?php namespace App\Models;

use CodeIgniter\Database\ConnectionInterface;

class ConfiguracioModel
{
    protected $db;

    public  function __construct(ConnectionInterface &$db)
    {
        $this->db =& $db;
    }

    /*
     * Get all rows from table
     */
    function getEmpresa($id){
        $builder = $this->db->table('empreses');
        $builder->select('*');
        $builder->join('sys_users', 'sys_users.empresa_id_user = empreses.id_empresa', 'left');
        $builder->join('disseny', 'disseny.empresa_id_disseny = empreses.id_empresa', 'left');
        $builder->where('empreses.id_empresa', $id);
        $query = $builder->get()->getResult();
        return $query;
    }

}