with('chapters')->withCount([ 'chapters', 'chapters as chapters_to_sync' => function (Builder $query) { $query->where('sync_offline', 1); }, ])->get(); return view('index', compact(['courses'])); } public function download(SymfonyCastDlService $symfonyCastDlService) { $symfonyCastDlService->getInfo(); } }