I'm trying to find something along the lines of insert_or_update (similar to what Laravel offers) in CodeIgniter 3. The closest I have found is $this->db->replace(), but I can't find anything that specifies that it can/can't be used alongside a ->where(). Based on the docs I don't believe this will work since it doesn't list ->where() as an option, but I wanted to double check this as well.
I'm hoping I can do something like...
$data = [...];
$whereSearch = [...];
$this->db->replace($data)->where($whereSearch);
The key here to quote the documentation is
using PRIMARY and UNIQUE keys as the determining factor.
Replace only works based on your keys to replace the values in a table. You might find Does replace into have a where clause? helpful as well.