Fix models database calls and structural updates

This commit is contained in:
Hamza-Ayed
2026-05-21 18:42:33 +03:00
parent 92755472e1
commit 3c695e88fd
5 changed files with 43 additions and 43 deletions

View File

@@ -13,15 +13,15 @@ class Campaign extends BaseModel
/**
* Get all campaigns for a company
*/
public function findAllByCompany(int $companyId)
public static function findAllByCompany(int $companyId)
{
return $this->db->query(
return \App\Core\Database::select(
"SELECT c.*, g.name as group_name, t.name as template_name
FROM {$this->table} c
FROM " . static::$table . " c
LEFT JOIN contact_groups g ON c.group_id = g.id
LEFT JOIN templates t ON c.template_id = t.id
WHERE c.company_id = ? ORDER BY c.id DESC",
[$companyId]
)->fetchAll();
);
}
}