1
0
mirror of https://github.com/robonen/education-project.git synced 2026-03-20 02:44:31 +00:00

Merge branch 'timetable' of github.com:Robonen/education-project into timetable

This commit is contained in:
nikden13
2020-12-17 01:11:39 +07:00
9 changed files with 104 additions and 135 deletions

View File

@@ -47,14 +47,14 @@ class TimetableController extends Controller
}
$dateTimetables = [];
if (!$filterTimetables->isEmpty()) {
//if (!$filterTimetables->isEmpty()) {
for ($i = 0; $i < 6; $i++) {
$date = Carbon::parse($request->input('date'))
->startOfWeek()
->addDays($i)
->format('Y-m-d');
array_push($dateTimetables, [$date => $filterTimetables->where('date', $date)->values()]);
}
// }
}
return response()->json($dateTimetables, 200);
}

View File

@@ -7,6 +7,7 @@ use App\Http\Requests\StudentRequest;
use App\Models\SchoolClass;
use App\Models\Student;
use Illuminate\Http\JsonResponse;
use App\Models\AnswerToTask;
class StudentController extends Controller
{
@@ -66,7 +67,17 @@ class StudentController extends Controller
return response()->json(collect($student)->except('school_class'), 200);
}
public function destroy(Student $student)
{
$user = $student->user;
$user->delete();
return response()->json(null, 204);
}
public function getAnswers(Student $student) {
return AnswerToTask::where('student_id', '=', $student->id)->get();
}
}