Welcome Guest, Not a member yet? Register   Sign In
Cant Load Model In Controller
#1
Question 

Hi,
I'm unable to load Model in the Controller I tried to follow the tutorials but don't know where I messed up or what am I doing wrong.

RecordModel.php
PHP Code:
<?php

namespace App\Models;
use 
CodeIgniter\Model;

class 
RecordModel extends Model
{
    //protected $db;
    protected $table      'records';
    protected $primaryKey 'id';

    protected $useAutoIncrement true;

    protected $returnType    'array';
    protected $useSoftDeletes false;

    protected $allowedFields = ['name''email'];

    protected $useTimestamps true;
    protected $createdField  'created_at';

    protected $validationRules    = [];
    protected $validationMessages = [];
    protected $skipValidation    false;


And this is the controller


PHP Code:
<?php

namespace App\Controllers;

use 
App\Models\RecordModel;

class 
Home extends BaseController
{
    public function index()
    {
        // return view('welcome_message');

        $records = new RecordModel();
        $data $records->findAll();
        print_r($data);
    }


this is the error i get

Code:
Error
Class 'App\Models\RecordModel' not found
APPPATH/Controllers/Home.php at line 13
Reply


Messages In This Thread
Cant Load Model In Controller - by Nomie7 - 10-11-2021, 04:01 AM
RE: Cant Load Model In Controller - by Nomie7 - 10-12-2021, 04:52 AM
RE: Cant Load Model In Controller - by InsiteFX - 10-12-2021, 01:26 AM
RE: Cant Load Model In Controller - by ikesela - 10-12-2021, 08:20 PM
RE: Cant Load Model In Controller - by Nomie7 - 10-13-2021, 05:11 AM
RE: Cant Load Model In Controller - by Nomie7 - 10-13-2021, 10:58 AM
RE: Cant Load Model In Controller - by Nomie7 - 10-13-2021, 12:01 PM



Theme © iAndrew 2016 - Forum software by © MyBB