CodeIgniter Forums
Celling class model and function model - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Celling class model and function model (/showthread.php?tid=74301)



Celling class model and function model - chau - 09-08-2019

I am having problems when calling the function model to the controller, please help me

thank you.


chau


RE: Celling class model and function model - InsiteFX - 09-08-2019

So what problems are you having? That tell's nothing about your problem.

It would be something like this:

PHP Code:
// Loading a model in the Controller.
$users = new UserModel();

// Using the Model in the Controller.
$user $users->getUserById($id); 

If that is what you are looking for.


RE: Celling class model and function model - mintwint - 09-08-2019

(09-08-2019, 08:26 AM)InsiteFX Wrote: So what problems are you having? That tell's nothing about your problem.

It would be something like this:

PHP Code:
// Loading a model in the Controller.
$users = new UserModel();

// Using the Model in the Controller.
$user $users->getUserById($id); 

If that is what you are looking for.

do not forget to add the model at the beginning of the controller:

PHP Code:
use App\Models\UsersModel