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
2022-12-07 11:37:50 +01:00
parent b992d05312
commit 25e28f8193
7 changed files with 82 additions and 16 deletions

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'));
}
}