CourseWork/routes/web.php

62 lines
3.0 KiB
PHP
Raw Permalink Normal View History

2024-04-15 16:23:05 +04:00
<?php
2024-06-16 00:41:31 +04:00
use App\Http\Controllers\ProfileController;
2024-06-22 23:59:16 +04:00
use App\Http\Middleware\AdminAction;
2024-06-23 17:02:18 +04:00
use App\Http\Middleware\StudentAction;
2024-06-22 23:59:16 +04:00
use App\Http\Middleware\TeacherAction;
2024-06-16 00:41:31 +04:00
use Illuminate\Support\Facades\Route;
2024-04-16 13:27:51 +04:00
use App\Http\Controllers\GradeController;
2024-05-07 12:14:18 +04:00
use App\Http\Controllers\GradeSubjectController;
2024-05-07 15:05:10 +04:00
use App\Http\Controllers\GradeTeacherController;
2024-05-08 13:34:54 +04:00
use App\Http\Controllers\LessonController;
2024-05-17 18:46:12 +04:00
use App\Http\Controllers\ScoreController;
2024-04-23 14:52:49 +04:00
use App\Http\Controllers\StudentController;
2024-04-17 10:11:31 +04:00
use App\Http\Controllers\SubjectController;
2024-05-06 17:47:25 +04:00
use App\Http\Controllers\SubjectTeacherController;
2024-04-23 14:52:49 +04:00
use App\Http\Controllers\TeacherController;
2024-04-15 16:23:05 +04:00
Route::get('/', function () {
2024-06-16 00:41:31 +04:00
return redirect()->route('profile.edit');
});
Route::get('/dashboard', function () {
return view('dashboard');
})->middleware(['auth', 'verified'])->name('dashboard');
Route::middleware('auth')->group(function () {
Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
Route::resources([
'grades' => GradeController::class,
'subjects' => SubjectController::class,
'students' => StudentController::class,
'teachers' => TeacherController::class,
'grades.lessons' => LessonController::class,
]);
2024-06-22 23:59:16 +04:00
Route::middleware([AdminAction::class])->group(function () {
Route::resource('teachers.subjects', SubjectTeacherController::class)->except('index');
Route::resource('teachers.subjects.grades', GradeTeacherController::class)->except('index', 'show');
Route::resource('grades.subjects', GradeSubjectController::class)->except('index', 'show');
});
2024-06-16 00:41:31 +04:00
2024-06-22 23:59:16 +04:00
Route::middleware([TeacherAction::class])->group(function () {
Route::get('lessons/{lesson}/scores', [ScoreController::class, 'show'])->name('lessons.scores.show');
Route::put('lessons/{lesson}/scores', [ScoreController::class, 'update'])->name('lessons.scores.update');
2024-06-23 00:57:29 +04:00
Route::get('grades/{grade}/subjects/{subject}/journal', [GradeSubjectController::class, 'journal'])->name('grades.subjects.journal');
2024-06-24 00:51:05 +04:00
Route::get('grades/{grade}/list-students', [GradeController::class, 'listStudents'])->name('list-students');
2024-06-24 22:04:44 +04:00
Route::get('grades/{grade}/subjects/{subject}/journal/export-excel', [GradeSubjectController::class, 'exportToExcel'])->name('export-excel');
2024-06-22 23:59:16 +04:00
});
2024-06-16 00:41:31 +04:00
2024-06-23 17:02:18 +04:00
Route::middleware([StudentAction::class])->group(function () {
Route::get('export-pdf', [SubjectController::class, 'exportToPDF'])->name('export-pdf');
Route::get('subjects/{subject}/student-scores', [StudentController::class, 'scores'])->name('student-scores');
Route::get('student-debts', [StudentController::class, 'debts'])->name('student-debts');
Route::get('teachers/{teacher}/subjects', [SubjectTeacherController::class, 'index'])->name('teachers.subjects.index');
});
2024-04-15 16:23:05 +04:00
});
2024-04-16 13:27:51 +04:00
2024-06-16 00:41:31 +04:00
require __DIR__.'/auth.php';