maintanance and downloading files.
This commit is contained in:
18
app/Http/Controllers/ChapterController.php
Normal file
18
app/Http/Controllers/ChapterController.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\SymfonyCastDl\SymfonyCastDlService;
|
||||
use App\Models\Chapter;
|
||||
|
||||
class ChapterController extends Controller
|
||||
{
|
||||
public function index(Chapter $chapter, SymfonyCastDlService $symfonyCastDlService)
|
||||
{
|
||||
$symfonyCastDlService->videoSize($chapter);
|
||||
$symfonyCastDlService->downloadFile($chapter);
|
||||
// $symfonyCastDlService->videoSize($chapter);
|
||||
// file_put_contents('movie.avi', file_get_contents($chapter->video_link));
|
||||
dd($chapter->toArray());
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\SymfonyCastDl\HtmlParser;
|
||||
use App\Http\SymfonyCastDl\SymfonyCastDlService;
|
||||
use App\Jobs\DownloadVideoFile;
|
||||
use App\Models\Chapter;
|
||||
use App\Models\Course;
|
||||
use Illuminate\View\View;
|
||||
@@ -15,17 +16,10 @@ class CourseController extends Controller
|
||||
return view('course.index', compact('course'));
|
||||
}
|
||||
|
||||
public function chapter(Chapter $chapter, HtmlParser $htmlParser)
|
||||
{
|
||||
$service = new SymfonyCastDlService($htmlParser);
|
||||
$service->videoSize($chapter);
|
||||
|
||||
dd($chapter->toArray());
|
||||
}
|
||||
|
||||
public function sync(Course $course)
|
||||
{
|
||||
$course->chapters->each->update(['sync_offline' => 1]);
|
||||
$course->chapters->each(fn($chapter) => DownloadVideoFile::dispatch($chapter->id));
|
||||
return redirect(route('course.index', ['course' => $course]));
|
||||
}
|
||||
|
||||
|
||||
@@ -12,12 +12,13 @@ class Index extends Controller
|
||||
public function index()
|
||||
{
|
||||
$courses = Course::with('chapters')->withCount('chapters')->get();
|
||||
|
||||
// dd($courses->toArray());
|
||||
return view('index', compact(['courses']));
|
||||
}
|
||||
|
||||
public function download(HtmlParser $htmlParser)
|
||||
public function download(SymfonyCastDlService $symfonyCastDlService)
|
||||
{
|
||||
$service = new SymfonyCastDlService($htmlParser);
|
||||
$service->getInfo();
|
||||
$symfonyCastDlService->getInfo();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user