Welcome Guest, Not a member yet? Register   Sign In
Call model instance with custom schema
#3

(09-13-2022, 06:27 PM)kenjis Wrote: I'm not sure your case works with CodeIgniter.

At least, the DB connection has a schema:
https://codeigniter4.github.io/CodeIgnit...-of-values

I did find it after an hour of posting this, leaving this here in case someone else need it (mostly future me):

// override the constructor of the specific model
public function __construct(ConnectionInterface &$db = null, ValidationInterface $validation = null)
{
    parent::__construct($db, $validation); // apply the extended controller's constructor
    $this->db->schema = 'schema_name'; // modify the specific property in this case the db schema
}
Reply


Messages In This Thread
RE: Call model instance with custom schema - by luckyDev - 09-14-2022, 10:05 PM



Theme © iAndrew 2016 - Forum software by © MyBB