<?php

namespace App\Services;

use App\Core\Database;

class HomepageExperimentService
{

public static function create(
int $conferenceId,
int $userId
)
{

$db=
Database::getInstance();

return
$db
->prepare("

INSERT INTO
conference_home_experiments(

conference_id,

experiment_name,

variant_a,

variant_b,

created_by

)

VALUES(

?,

?,

'A',

'B',

?

)

")

->execute([

$conferenceId,

'Homepage Experiment',

$userId

]);

}

public static function latest(
int $conferenceId
)
{

$db=
Database::getInstance();

$stmt=
$db
->prepare("

SELECT *

FROM
conference_home_experiments

WHERE conference_id=?

ORDER BY id DESC

LIMIT 1

");

$stmt
->execute([

$conferenceId

]);

return
$stmt
->fetch()

??

[];

}

}
