lessons()->filter()->get(); } public function getGrades(): Collection { return Grade::all(); } public function create(array $data): Lesson { $lesson = Lesson::create($data); $lesson ->students() ->syncWithPivotValues($lesson->grade->students->pluck('id')->all(), ['score' => ScoreEnum::WithoutScore]); return $lesson; } public function update(Model $model, array $data): Lesson { $model->update($data); return $model; } public function delete($model): void { $model->delete(); } }