Welcome Guest, Not a member yet? Register   Sign In
Correct way to call the Model
#1
Sad 

Hi,

I have 2 Controllers and 1 Model:
[Controllers]
Employee
User

[Model]
UserModel
id
name
is_employee


An User is all the people registered in the app. An Employee is an User with is_employee == true

--//--

When i need an "simple" user, i use(inside User Controller)):

$this->userModel->getUser($id)

When i need all users:

$this->userModel->getAll()

--//--

When i need an employee i use (inside Employee Controller):

$this->userModel->select('id,name')->where('is_employee',true)->findAll()

Is this ok? is this the right way to do this?

Or i must have a method inside User to get the employee? Should Employee controller have direct access to UserModel ?

Pls, help. this is driving me insane!!!

Sad
Reply


Messages In This Thread
Correct way to call the Model - by snape - 07-08-2021, 01:25 PM
RE: Correct way to call the Model - by paliz - 07-09-2021, 01:45 AM
RE: Correct way to call the Model - by ikesela - 07-09-2021, 04:16 AM
RE: Correct way to call the Model - by InsiteFX - 07-09-2021, 05:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB