Welcome Guest, Not a member yet? Register   Sign In
Model within a model
#4

I can't think of any reason why not, have you tried? 

To match your model names:
PHP Code:
<?php

namespace App\Models;

use 
CodeIgniter\Model;
use 
App\Models\Settings_model;
class 
Users_model extends Model {

    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
        $this->Settings = new Settings_model();
    }



PHP Code:
<?php

namespace App\Models;

use 
CodeIgniter\Model;
use 
App\Models\Users_model;
class 
Settings_model extends Model {

    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
 
        $this->Users = new Users_model();
    }

Reply


Messages In This Thread
Model within a model - by LuxesR - 06-29-2021, 12:31 PM
RE: Model within a model - by BilltheCat - 06-29-2021, 12:52 PM
RE: Model within a model - by LuxesR - 06-29-2021, 01:47 PM
RE: Model within a model - by BilltheCat - 06-29-2021, 02:06 PM
RE: Model within a model - by paulbalandan - 06-30-2021, 12:54 AM
RE: Model within a model - by InsiteFX - 06-30-2021, 01:58 AM
RE: Model within a model - by LuxesR - 06-30-2021, 02:49 AM
RE: Model within a model - by paulbalandan - 06-30-2021, 07:07 PM
RE: Model within a model - by LuxesR - 07-01-2021, 02:58 AM
RE: Model within a model - by paulkd - 07-01-2021, 12:36 AM
RE: Model within a model - by ikesela - 07-01-2021, 02:59 AM
RE: Model within a model - by paulbalandan - 07-01-2021, 04:25 AM
RE: Model within a model - by LuxesR - 07-01-2021, 05:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB