Deploy: 2026-05-21 15:33:14

This commit is contained in:
Hamza-Ayed
2026-05-21 15:33:14 +03:00
parent aae860486a
commit 6210a57565
13 changed files with 1826 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Models;
/**
* Campaign Model
* Manages broadcast campaigns linking templates to contact groups.
*/
class Campaign extends BaseModel
{
protected string $table = 'campaigns';
/**
* Get all campaigns for a company
*/
public function findAllByCompany(int $companyId)
{
return $this->db->query(
"SELECT c.*, g.name as group_name, t.name as template_name
FROM {$this->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();
}
}