task-5 (Lessons and Scores) #5

Merged
klllst merged 16 commits from feature/task-5 into develop 2024-05-27 18:42:11 +04:00
Showing only changes of commit 65c47fe151 - Show all commits

View File

@ -2,6 +2,7 @@
namespace App\Services;
use App\Enums\ScoreEnum;
use App\Models\Student;
use App\Models\User;
use Illuminate\Pagination\LengthAwarePaginator;
@ -27,6 +28,9 @@ class StudentService implements ServiceInterface
'grade_id' => $data['grade_id'],
]);
$student->user()->save($user);
$student
->lessons()
->syncWithPivotValues($student->grade->lessons->pluck('id')->all(), ['score' => ScoreEnum::WithoutScore]);
return $student;
}