Added helper file, replaced size file for human version as a helper method, next prev buttons for chapters.

This commit is contained in:
Krzysztof Płaczek committed 2022-12-07 11:37:50 +01:00
1 parent b992d05312
commit 25e28f8193
7 files changed
+82 -16

No files matched your search

+6 -2
View File
@@ -10,9 +10,13 @@ class ChapterController extends Controller
public function index(Chapter $chapter, SymfonyCastDlService $symfonyCastDlService)
{
$symfonyCastDlService->videoSize($chapter);
if($chapter->sync_offline){
if ($chapter->sync_offline) {
$symfonyCastDlService->downloadFile($chapter);
}
return view('chapter.index', compact('chapter'));
$chapters = $chapter->course->chapters;
$next = $chapters->where('order', '>', $chapter->order)->first();
$prev = $chapters->where('order', '<', $chapter->order)->sortByDesc('order')->first();
return view('chapter.index', compact('chapter', 'chapters', 'prev', 'next'));
}
}