Welcome Guest, Not a member yet? Register   Sign In
Model in subfolder not working
#1

In the controller:

PHP Code:
$companyListModel = new \App\Models\rt3\CompanyListModel(); 

The Models folder has an Rt3 folder with the CompanyListModel.php in it.

PHP Code:
<?php namespace App\Models;

use 
CodeIgniter\Model;

class 
CompanyListModel extends Model
{
    protected $table 'CompanyList';
    protected $DBGroup 'rt3';

    protected $allowedFields = [
      // database list here
    ];

    protected $primaryKey "id";

    protected $returnType 'App\Entities\CompanyList';




Get this error:

Code:
Class 'App\Models\Rt3\CompanyListModel' not found

What am I doing wrong?
Reply
#2

<?php namespace App\Models; <- wrong namespace
Reply
#3

(01-12-2022, 01:36 PM)iRedds Wrote: <?php namespace App\Models; <- wrong namespace

Thank you, that worked!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB