#211 TaskInformerModel migration

This commit is contained in:
Daniel Brendel
2025-02-03 22:23:15 +01:00
parent 48572dee65
commit f2ec489377
3 changed files with 9 additions and 13 deletions

View File

@@ -16,7 +16,7 @@ class TaskInformerModel extends \Asatru\Database\Model {
public static function userInformed($userId, $taskId, $what)
{
try {
$data = static::raw('SELECT * FROM `' . self::tableName() . '` WHERE user = ? AND task = ? AND what = ?', [$userId, $taskId, $what])->first();
$data = static::raw('SELECT * FROM `@THIS` WHERE user = ? AND task = ? AND what = ?', [$userId, $taskId, $what])->first();
if ($data) {
return true;
}
@@ -57,7 +57,7 @@ class TaskInformerModel extends \Asatru\Database\Model {
$mailobj->setProperties(mail_properties());
$mailobj->send();
static::raw('INSERT INTO `' . self::tableName() . '` (user, task, what) VALUES(?, ?, ?)', [$user->get('id'), $task->get('id'), $what]);
static::raw('INSERT INTO `@THIS` (user, task, what) VALUES(?, ?, ?)', [$user->get('id'), $task->get('id'), $what]);
$count++;
}
@@ -67,14 +67,4 @@ class TaskInformerModel extends \Asatru\Database\Model {
throw $e;
}
}
/**
* Return the associated table name of the migration
*
* @return string
*/
public static function tableName()
{
return 'taskinformer';
}
}