Welcome Guest, Not a member yet? Register   Sign In
How to use two models in a controller
#3

(05-11-2020, 06:40 AM)kilishan Wrote: Your example works just fine. Personally, I'd use the model() helper just to ensure I don't get more than 1 instance of the model created, but what you've done works fine.

EDIT:

if you're just using a model in a single method, there's no need to assign it to $this, just use a local variable:

PHP Code:
$authenticationModel = new AuthenticationModel();
$username $this->request->getPost('username');
$password $this->request->getPost('password');

$boolen $authenticationModel->authentication($username$password); 


kilishan, thank for your reply. I will edit about this ~
Reply


Messages In This Thread
RE: How to use two models in a controller - by hoffmanchan - 05-11-2020, 07:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB