Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class 'App\Models\UserModel' not found #3014

Closed
ckgan88 opened this issue May 18, 2020 · 2 comments
Closed

Class 'App\Models\UserModel' not found #3014

ckgan88 opened this issue May 18, 2020 · 2 comments

Comments

@ckgan88
Copy link

ckgan88 commented May 18, 2020

use CodeIgniter\Controller;
use App\Models\UserModel;

class Login extends Controller {

protected $helpers = ['html','form', 'url'];

public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) {
    parent::initController($request, $response, $logger);

    //--------------------------------------------------------------------
    // Preload any models, libraries, etc, here.
    //--------------------------------------------------------------------

    $this->session   = Services::session();
    $this->usermodel = new UserModel(); <-------------- this no found
}

====================== Model Class Below ======================

namespace App\Models;

use CodeIgniter\Model;

class Usermodel extends Model {

protected $table = 'tbl_users';

public function __construct() {
    parent::__construct();
    
    $db = \Config\Database::connect();
    $bd = $db->table($this->table);
}

}

In my localhost, it work good. But once i upload to server. It show
Class 'App\Models\UserModel' not found
Please help. Im new Codeigniter. Thanks

@samsonasik
Copy link
Member

your classname must be UserModel, not Usermodel. Please ask in forum instead for question.

@ckgan88
Copy link
Author

ckgan88 commented May 18, 2020

your classname must be UserModel, not Usermodel. Please ask in forum instead for question.

Opsss, Thanks. You are awesome thanks.

@ckgan88 ckgan88 closed this as completed May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants