I have worked with CI 3 so far and would like to address several database tables separately (no joins) in a new model (in CI 4).
<?php namespace App\Models;
use CodeIgniter\Model;
class MyModel extends Model {
protected $table = 'main_table';
public function getAll($uid = false) {
return $this->where(['hidden' => '0'])
->where(['deleted' => '0'])
->findAll();
}
public function getMainImage($pid) {
return $this->from('another_table')
->where(['pid' => $pid])
->findAll();
}
}
For some reason the whole thing doesn't seem to work out.
Can someone help me?