This function can be used in WHMCS modules to create a new to do item in the "to do" tool of WHMCS
use Illuminate\Database\Capsule\Manager as Capsule;
function createtodoitem ($title, $message) {
try {
$insert_array = [
"title" => $title,
"date" => date("Y-m-d"),
"description" => $message,
"status" => "New",
"duedate" => date("Y-m-d"),
];
Capsule::table('tbltodolist')
->insert($insert_array);
} catch(\Illuminate\Database\QueryException $ex){
echo $ex->getMessage();
} catch (Exception $e) {
echo $e->getMessage();
}
}