<?php

if(!function_exists('get_empreses')){
    function get_empreses()
    {
        $db = \Config\Database::connect();
        $builder = $db->table('empreses');
        $builder->select('*');
        $query = $builder->get()->getResult();
        return $query;
    }
}


if(!function_exists('get_mods')){
    function get_mods($id)
    {
        $db = \Config\Database::connect();
        $builder = $db->table('mods');
        $builder->select('*');
        $builder->where('id_opcio_mod', $id);
        $builder->orderBy('position_mod', 'ASC');
        $query = $builder->get()->getResult();
        return $query;
    }

    function get_mods_multiple($id)
    {
        $db = \Config\Database::connect();
        $builder = $db->table('mods');
        $builder->select('*');
        $builder->where('id_mod', $id);
        $query = $builder->get()->getResult();
        return $query;
    }
}