This is from a blog that I' am working on.
You can see that I get an instance to all 3 models.
PHP Code:
// -------------------------------------------------------------------
/**
* post ()
* -------------------------------------------------------------------
*
* @param int $id
*/
public function post(int $id = 0)
{
$posts = new PostModel($this->request);
$categories = new CategoryModel();
$comments = new CommentModel($this->request);
$data = [
'posts' => $posts->getPost($id),
'comments' => $comments->getComments($id),
'categories' => $categories->getTopCategories(),
'titles' => $categories->getCategoryTitles($id),
'title' => 'Blog Post',
'typography' => Services::typography(),
];
$data['pageHeading'] = $data['titles']['title'];
$data['subHeading'] = $data['posts']['sub_title'];
// Make all variables global to all views...
echo view('Insitefx\Blog\Views\view_data', $data);
echo view('Insitefx\Blog\Views\post\index');
}
In the $data section you can see how I' am reading from all 3 tables PostModel, CategoryModel and CommentModel.
You should have a separate Model for each of your tables.
You would do everything like above for Inserting, Updating and Editing.
Hope that will get you started, would be best to read the User Guide on Working with Databases and Modeling Data.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )