I am new to CI 3 and groceryCRUD, started to implement a simple project management system for my own use.
I come from ASP.NET background and have not touched PHP in ~4 years.
Right now I want to implement a simple permission system.
Keys in DB are set up like this:
table projects: int ProjectId; int ManagerId; table project_permissions: int UserId; int ProjectId; table users: int UserId; string Name;
I wanted to filter projects where user has access permission like this:
$userId = $this->ion_auth->get_user_id(); $where = 'projects.ProjectId = project_permissions.ProjectId AND project_permissions.UserId = ' . $userId; $this->grocery_crud->where($where);
What is the standard way to implement this in CI?
Another question I have is, how to join two "where" statements in CI? For example, if I wanted the grid to show results of both 'where' statements:
$this->grocery_crud->where( 'UserId = ' . $userId); // $userId comes from session $this->grocery_crud->where( 'UserId = 5'); //