<?php

namespace App\Services;

use App\Core\Database;

class HomepageWorkspaceService
{

public static function save(
int $conferenceId,
string $layout,
int $userId
)
{

$db=
Database::getInstance();

return
$db
->prepare("

INSERT INTO
conference_home_workspace(

conference_id,

layout_name,

layout_json,

created_by

)

VALUES(

?,

?,

?,

?

)

")

->execute([

$conferenceId,

'Workspace '
.
date(
'His'
),

$layout,

$userId

]);

}

public static function latest(
int $conferenceId
)
{

$db=
Database::getInstance();

$stmt=
$db
->prepare("

SELECT *

FROM
conference_home_workspace

WHERE conference_id=?

ORDER BY id DESC

LIMIT 1

");

$stmt
->execute([

$conferenceId

]);

return
$stmt
->fetch()

??

[];

}

}
