Moved video files to public/videos directory, small refactoring.

This commit is contained in:
Krzysztof Płaczek
2023-03-30 12:46:30 +02:00
parent 5902bf7c2b
commit 5784cf8ed3
10 changed files with 42 additions and 41 deletions

View File

@@ -5,14 +5,19 @@ namespace App\Http\Controllers;
use App\Http\SymfonyCastDl\HtmlParser;
use App\Http\SymfonyCastDl\SymfonyCastDlService;
use App\Models\Course;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Http\Request;
class Index extends Controller
{
public function index(string $track = null)
{
$courses = Course::where('tracks', 'like', '%'.$track.'%')->with('chapters')->withCount('chapters')->get();
$courses = Course::where('tracks', 'like', '%' . $track . '%')->with('chapters')->withCount([
'chapters',
'chapters as chapters_to_sync' => function (Builder $query) {
$query->where('sync_offline', 1);
},
])->get();
return view('index', compact(['courses']));
}