Welcome Guest, Not a member yet? Register   Sign In
Custom chaining in codeigniter4 model
#1

(This post was last modified: 01-08-2022, 02:52 AM by RedWd.)

Hi everyone, like suggested in title i would like to do somethings like this:

PHP Code:
$UserModel->Where('age','18')->WithCompanyInfo()->findAll(); 

so, in my UserModel i must create this method WithCompanyInfo that refer to another table / model CompanyModel with external key "user_id".

PHP Code:
  public function WithCompanyInfo ()
  {
    //somehow tell ci4 to make a join and retrieve companymodel info
    return $this;
  

How can be done that?
thanks

UPDATE

I've found how to manage that.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB