For the complete documentation index, see llms.txt. This page is also available as Markdown.

Adding Entries to DB

Manipulating the database

Introduction

Let's check how we can add data into the newly created table

Add a Model Class

In order to communicate with the database you need a model. IceHrm uses AdoDB as the ORM. But it provides an abstraction layer on top of AdoDB.

icehrm
    |--extnsions
          |--tasks
               |--src
                  |--Tasks
                       |--Model
                            |--Task.php
                       |--Extension.php
                       |--Migration.php
               |--meta.json

Task.php

<?php

namespace Tasks\Model;

use Classes\ModuleAccess;
use Model\BaseModel;

class Task extends BaseModel
{
    public $table = 'Tasks';
}

Update Extension Include File

tasks.php

Create a Random Task

Just for testing we will create a new task on the view file itself, and print it on screen.

web/index.php

Last updated

Was this helpful?