Changed links to chapters, button to synchronize chapters from courses list, dark mode.

This commit is contained in:
Krzysztof Płaczek
2022-12-07 19:57:57 +01:00
parent 25e28f8193
commit d4d8330d83
7 changed files with 50 additions and 29 deletions

View File

@@ -4,11 +4,14 @@ namespace App\Http\Controllers;
use App\Http\SymfonyCastDl\SymfonyCastDlService;
use App\Models\Chapter;
use App\Models\Course;
class ChapterController extends Controller
{
public function index(Chapter $chapter, SymfonyCastDlService $symfonyCastDlService)
public function index(Course $course, int $chapter, SymfonyCastDlService $symfonyCastDlService)
{
$chapter = $course->chapters->firstWhere('order', $chapter);
$symfonyCastDlService->videoSize($chapter);
if ($chapter->sync_offline) {
$symfonyCastDlService->downloadFile($chapter);

View File

@@ -16,11 +16,11 @@ class CourseController extends Controller
return view('course.index', compact('course'));
}
public function sync(Course $course)
public function sync(Course $course): \Illuminate\Http\RedirectResponse
{
$course->chapters->each->update(['sync_offline' => 1]);
$course->chapters->each(fn($chapter) => DownloadVideoFile::dispatch($chapter->id));
return redirect(route('course.index', ['course' => $course]));
return redirect()->back();
}
}