CourseWork/routes/web.php

53 lines
2.1 KiB
PHP
Raw 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;
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-16 00:41:31 +04:00
2024-06-17 17:38:29 +04:00
Route::get('export-pdf', [SubjectController::class, 'exportToPDF'])->name('export-pdf');
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';