30 lines
780 B
PHP
30 lines
780 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Controllers;
|
||
|
|
|
||
|
|
use App\Models\Lab;
|
||
|
|
use App\Models\Quiz;
|
||
|
|
use Illuminate\View\View;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Bibliothèque du prof : labs et quiz réels (séparation vitrine/
|
||
|
|
* application, 2026-10-13) — distincte de /bibliotheque (vitrine,
|
||
|
|
* démonstration). Regroupée comme /banque-quiz.
|
||
|
|
*/
|
||
|
|
class BibliothequeProfController extends Controller
|
||
|
|
{
|
||
|
|
public function show(): View
|
||
|
|
{
|
||
|
|
$quizzes = Quiz::where('partage', true)
|
||
|
|
->with(['classe.etablissement'])
|
||
|
|
->withCount('questions')
|
||
|
|
->latest()
|
||
|
|
->get();
|
||
|
|
|
||
|
|
return view('bibliotheque-app', [
|
||
|
|
'labs' => Lab::orderBy('titre')->get(),
|
||
|
|
'groupesQuiz' => $quizzes->groupBy(fn (Quiz $q) => $q->theme ?? '')->sortKeys(),
|
||
|
|
]);
|
||
|
|
}
|
||
|
|
}
|