<?php

namespace App\Services;

use App\Core\Database;

class HomepageCollaborationService
{

public static function dashboard(
int $conferenceId
): array
{

$db=
Database::getInstance();

$out=[];

$q=
$db
->prepare("

SELECT
COUNT(*)

FROM
conference_home_notifications

WHERE

conference_id=?

AND

is_read=0

");

$q
->execute([

$conferenceId

]);

$out[
'unread'
]=
(int)
$q
->fetchColumn();

$q=
$db
->prepare("

SELECT

activity_text,

created_at

FROM
conference_home_activity

WHERE conference_id=?

ORDER BY id DESC

LIMIT 10

");

$q
->execute([

$conferenceId

]);

$out[
'activity'
]=

$q
->fetchAll();

return
$out;

}

}
