feat(video-clip): add video-clip page with video preview + logs

This commit is contained in:
Yassine Doghri 2021-12-23 16:56:06 +00:00
commit 42538dd757
11 changed files with 106 additions and 14 deletions

View file

@ -114,6 +114,26 @@ class ClipModel extends Model
return $found;
}
public function getVideoClipById(int $videoClipId): ?VideoClip
{
$cacheName = "video-clip#{$videoClipId}";
if (! ($found = cache($cacheName))) {
$clip = $this->find($videoClipId);
if ($clip === null) {
return null;
}
// @phpstan-ignore-next-line
$found = new VideoClip($clip->toArray());
cache()
->save($cacheName, $found, DECADE);
}
return $found;
}
/**
* Gets all video clips for an episode
*