34 lines
728 B
PHP
34 lines
728 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Enums\ScoreEnum;
|
|
use App\Models\Lesson;
|
|
use App\Services\ScoreService;
|
|
use Illuminate\Http\Request;
|
|
|
|
class ScoreController extends Controller
|
|
{
|
|
|
|
public function __construct(
|
|
protected ScoreService $service,
|
|
){
|
|
}
|
|
|
|
public function show(Lesson $lesson)
|
|
{
|
|
return view('scores.show', [
|
|
'students' => $lesson->students,
|
|
'lesson' => $lesson,
|
|
'scores' => ScoreEnum::cases(),
|
|
]);
|
|
}
|
|
|
|
public function update(Request $request, Lesson $lesson)
|
|
{
|
|
$this->service->update($lesson, $request->toArray());
|
|
|
|
return redirect()->route('grades.lessons.show', [$lesson->grade, $lesson]);
|
|
}
|
|
}
|