This commit is contained in:
m.zargarov 2024-05-27 18:40:22 +04:00
parent 92efb4498d
commit 65c47fe151

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;
}