Changed links to chapters, button to synchronize chapters from courses list, dark mode.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user