Implement the update method

This commit is contained in:
Dave Smith-Hayes 2024-06-27 22:40:18 -04:00
parent 065f1a0cb1
commit 3d5050ef34

View File

@ -113,13 +113,36 @@ class ChannelRepository implements ChannelRepositoryInterface
return $results->insertId; return $results->insertId;
} }
/**
* @param Channel $channel
* @return bool
* @throws Throwable
*/
public function update(Channel $channel): bool public function update(Channel $channel): bool
{ {
$query = "UPDATE channels SET "; $query = "UPDATE channels SET name = ?,
slug = ?,
description = ?,
link = ?,
language = ?,
copyright = ?,
explicit = ?";
$results = await($this->db->query($query, [
$channel->getName(),
$channel->getSlug(),
$channel->getDescription(),
$channel->getLink(),
$channel->getLanguage(),
$channel->getCopyright(),
$channel->isExplicit(),
]));
return (bool) $results->affectedRows;
} }
public function delete(Channel $channel): bool public function delete(Channel $channel): bool
{ {
return false;
} }
} }