<?php

use App\Models\Settings;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Artisan;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/


// Auth::routes();


Route::group([
    'prefix' => 'admin',
    'middleware' => ['defineAdmin'], //, 'AuthenticateAdminsSession'
],  function () {
    Config::set('auth.defines', 'admin');

    // login routes
    Route::get('login', [App\Http\Controllers\Admin\Auth\LoginController::class, "showLoginForm"])->name('admin.login');
    Route::post('login', [App\Http\Controllers\Admin\Auth\LoginController::class, "login"]);



    Route::get('auth', function () {
        return view('admin.auth.closed-account');
    })->name('admin.closed-account');



    Route::group(['middleware' => ['admins:admin']], function () {

        // email verifiction routes
        Route::get('email/verify', 'Auth\VerificationController@show')->name('admin.verification.notice');
        Route::get('email/verify/{id}/{hash}', 'Auth\VerificationController@verify')->name('admin.verification.verify');
        Route::post('email/resend', 'Auth\VerificationController@resend')->name('admin.verification.resend');


        //admin logout route
        Route::post('logout', [App\Http\Controllers\Admin\Auth\LoginController::class, "logout"])->name('admin.logout');

        //closed account route
        Route::get('account/closed', 'UsersManagerController@ShowClosedAccountView')->name('admin.closedAccount');


        Route::group(['middleware' => ['verifyAccounts:admin']], function () {

            Route::post('profile/edit',         [App\Http\Controllers\Admin\UsersController::class, "editMyProfile"])->name('admin.users.myprofile.edit');
            Route::post('profile/editPassword', [App\Http\Controllers\Admin\UsersController::class, "editMyPassword"])->name('admin.users.mypassword.edit');

            Route::group(['middleware' => ['can:manageAny,App\Models\User']], function () {
                Route::get('users', [App\Http\Controllers\Admin\UsersController::class, "users"])->name('admin.users');
                Route::get('users/create', [App\Http\Controllers\Admin\UsersController::class, "showCreateAdminView"])->name('admin.users.create');
                Route::post('users/create', [App\Http\Controllers\Admin\UsersController::class, "create"]);
                Route::get('users/edit/{id}', [App\Http\Controllers\Admin\UsersController::class, "showUpdateAdminView"])->name('admin.users.update');
                Route::post('users/edit/{id}', [App\Http\Controllers\Admin\UsersController::class, "update"]);
                Route::post('users/edit/{id}/password', [App\Http\Controllers\Admin\UsersController::class, "updatePassword"])->name('admin.users.update.password');
                Route::post('users/edit/{id}/status', [App\Http\Controllers\Admin\UsersController::class, "updateAccountStatus"])->name('admin.users.update.status');
                Route::post('users/delete', [App\Http\Controllers\Admin\UsersController::class, "deleteUser"])->name('admin.users.delete');
                Route::get('users/{user_id}/permissions', [App\Http\Controllers\Admin\UsersController::class, "getUnregisteredUserPermissions"])->name('admin.users.permissions');
                Route::post('users/{user_id}/permissions/add', [App\Http\Controllers\Admin\UsersController::class, "addUserPermission"])->name('admin.users.permissions.add');
                Route::post('users/permissions/delete', [App\Http\Controllers\Admin\UsersController::class, "deleteUserPermission"])->name('admin.users.permissions.delete');
                Route::get('users/permissions/{permission_id}/details', [App\Http\Controllers\Admin\UsersController::class, "getPermissionDetails"])->name('admin.users.permissions.details');
            });



            Route::get('roles', [App\Http\Controllers\Admin\RolesController::class, "roles"])->name('admin.roles');
            Route::get('roles/create', [App\Http\Controllers\Admin\RolesController::class, "showCreateRoleView"])->name('admin.roles.create');
            Route::post('roles/create', [App\Http\Controllers\Admin\RolesController::class, "create"]);
            Route::post('roles/delete', [App\Http\Controllers\Admin\RolesController::class, "delete"])->name('admin.roles.delete');
            Route::get('roles/update/{id}', [App\Http\Controllers\Admin\RolesController::class, "showUpdateForm"])->name('admin.roles.update');
            Route::post('roles/update/{id}', [App\Http\Controllers\Admin\RolesController::class, "update"]);



            Route::group(['middleware' => ['can:manageAny,App\Models\Student']], function () {
                Route::get('students', [App\Http\Controllers\Admin\StudentsController::class, "students"])->name('admin.students');
                // Route::get('students/{division_id}', [App\Http\Controllers\Admin\StudentsController::class, "students"]);
                Route::get('students/create', [App\Http\Controllers\Admin\StudentsController::class, "showCreateStudentView"])->name('admin.students.create');
                Route::post('students/create', [App\Http\Controllers\Admin\StudentsController::class, "create"]);
                Route::get('students/view/{id}', [App\Http\Controllers\Admin\StudentsController::class, "showDetailsView"])->name('admin.students.view');
                Route::post('students/create/excel', [App\Http\Controllers\Admin\StudentsController::class, "createFromExcel"])->name('admin.students.excel.create');
                Route::get('students/edit/{id}', [App\Http\Controllers\Admin\StudentsController::class, "showUpdateStudentView"])->name('admin.students.update');
                Route::get('students/absence/{id}', [App\Http\Controllers\Admin\StudentsController::class, "showStudentAbsenceView"])->name('admin.students.absence');
                Route::post('students/absence/{id}/create', [App\Http\Controllers\Admin\StudentsController::class, "addAbsence"])->name('admin.students.absence.create');
                Route::post('students/absence/{id}/delete', [App\Http\Controllers\Admin\StudentsController::class, "deleteAbsence"])->name('admin.students.absence.delete');
                Route::post('students/edit/{id}', [App\Http\Controllers\Admin\StudentsController::class, "update"]);
                Route::post('students/edit/{id}/student', [App\Http\Controllers\Admin\StudentsController::class, "updateStudent"])->name('admin.students.update.student');
                Route::post('students/edit/{id}/mother', [App\Http\Controllers\Admin\StudentsController::class, "updateMother"])->name('admin.students.update.mother');
                Route::post('students/edit/{id}/father', [App\Http\Controllers\Admin\StudentsController::class, "updateFather"])->name('admin.students.update.father');
                Route::post('students/edit/{id}/addressTransEmergency', [App\Http\Controllers\Admin\StudentsController::class, "updateAddress_Transportation_Emergency"])->name('admin.students.update.addressTransEmergency');
                Route::post('students/edit/{id}/sequence', [App\Http\Controllers\Admin\StudentsController::class, "updateSequence"])->name('admin.students.update.sequence');
                Route::post('students/edit/{id}/languages', [App\Http\Controllers\Admin\StudentsController::class, "updateLanguages"])->name('admin.students.update.languages');
                Route::post('students/edit/{id}/health', [App\Http\Controllers\Admin\StudentsController::class, "updateHealth"])->name('admin.students.update.health');
                Route::post('students/delete', [App\Http\Controllers\Admin\StudentsController::class, "delete"])->name('admin.students.delete');
                Route::get('students/{student_id}/financials', [App\Http\Controllers\Admin\FinancialController::class, "studentFinancials"])->name('admin.financial.student');
                Route::post('students/{student_id}/financials/add', [App\Http\Controllers\Admin\FinancialController::class, "addStudentFinancials"])->name('admin.financial.student.add');
            });
            // Route::get('absence', [App\Http\Controllers\Admin\AbsenceController::class, "absence"])->name('admin.absence');
            
                Route::group(['middleware' => ['can:manageAny,App\Models\StudentFinancialRecord']], function () {
                Route::get('financials/students', [App\Http\Controllers\Admin\FinancialController::class, "financials"])->name('admin.financial.students');
                 
            });
                 
            Route::group(['middleware' => ['can:manageAny,App\Models\Parents']], function () {
                Route::get('parent/mother/search', [App\Http\Controllers\Admin\ParentsController::class, "mothersSearch"])->name('admin.parents.mother.search');
                Route::get('parent/father/search', [App\Http\Controllers\Admin\ParentsController::class, "fathersSearch"])->name('admin.parents.father.search');

                Route::get('parents', [App\Http\Controllers\Admin\ParentsController::class, "parents"])->name('admin.parents');
                Route::get('parents/deactivated', [App\Http\Controllers\Admin\ParentsController::class, "deactivatedParents"])->name('admin.parents.deactivated');
                Route::get('parents/deactivated/excel', [App\Http\Controllers\Admin\ParentsController::class, "deactivatedParentsExcel"])->name('admin.parents.deactivated.excel');
                Route::get('parents/create', [App\Http\Controllers\Admin\ParentsController::class, "showCreateParentView"])->name('admin.parents.create');
                Route::post('parents/create', [App\Http\Controllers\Admin\ParentsController::class, "create"]);
                Route::get('parents/edit/{id}', [App\Http\Controllers\Admin\ParentsController::class, "showUpdateParentView"])->name('admin.parents.update');
                Route::post('parents/edit/{id}', [App\Http\Controllers\Admin\ParentsController::class, "update"]);
                Route::post('parents/account/edit/{id}', [App\Http\Controllers\Admin\ParentsController::class, "updateAccount"])->name('admin.parents.acc.update');
                Route::post('parents/delete', [App\Http\Controllers\Admin\ParentsController::class, "delete"])->name('admin.parents.delete');
            });





            Route::get('stages', [App\Http\Controllers\Admin\StagesController::class, "stages"])->name('admin.stages');
            Route::get('stages/create', [App\Http\Controllers\Admin\StagesController::class, "showCreateView"])->name('admin.stages.create');
            Route::post('stages/create', [App\Http\Controllers\Admin\StagesController::class, "create"]);
            Route::get('stages/edit/{id}', [App\Http\Controllers\Admin\StagesController::class, "showUpdateView"])->name('admin.stages.update');
            Route::post('stages/edit/{id}', [App\Http\Controllers\Admin\StagesController::class, "update"]);
            Route::post('stages/delete', [App\Http\Controllers\Admin\StagesController::class, "delete"])->name('admin.stages.delete');
            Route::get('stage/levels', [App\Http\Controllers\Admin\StagesController::class, "getStageLevelsHaveDivisions"])->name('admin.stage.levels');
            Route::get('stage/levels/all', [App\Http\Controllers\Admin\StagesController::class, "getStageLevels"])->name('admin.stage.levels.all');

            Route::get('level/divisions', [App\Http\Controllers\Admin\LevelsController::class, "getLevelDivisions"])->name('admin.level.divisions');


            Route::group(['middleware' => ['can:manageAny,App\Models\Level', 'can:manageAny,App\Models\Division']], function () {
                Route::get('levels', [App\Http\Controllers\Admin\LevelsController::class, "levels"])->name('admin.levels');
                Route::get('levels/create', [App\Http\Controllers\Admin\LevelsController::class, "showCreateView"])->name('admin.levels.create');
                Route::post('levels/create', [App\Http\Controllers\Admin\LevelsController::class, "create"]);
                Route::get('levels/edit/{id}', [App\Http\Controllers\Admin\LevelsController::class, "showUpdateView"])->name('admin.levels.update');
                Route::post('levels/edit/{id}', [App\Http\Controllers\Admin\LevelsController::class, "update"]);
                Route::post('levels/delete', [App\Http\Controllers\Admin\LevelsController::class, "delete"])->name('admin.levels.delete');


                Route::get('divisions', [App\Http\Controllers\Admin\DivisionsController::class, "divisions"])->name('admin.divisions');
                Route::get('divisions/create', [App\Http\Controllers\Admin\DivisionsController::class, "showCreateView"])->name('admin.divisions.create');
                Route::post('divisions/create', [App\Http\Controllers\Admin\DivisionsController::class, "create"]);
                Route::get('divisions/edit/{id}', [App\Http\Controllers\Admin\DivisionsController::class, "showUpdateView"])->name('admin.divisions.update');
                Route::post('divisions/edit/{id}', [App\Http\Controllers\Admin\DivisionsController::class, "update"]);
                Route::post('divisions/delete', [App\Http\Controllers\Admin\DivisionsController::class, "delete"])->name('admin.divisions.delete');
            });




            Route::get('semesters', [App\Http\Controllers\Admin\SemestersController::class, "semesters"])->name('admin.semesters');
            Route::get('semesters/create', [App\Http\Controllers\Admin\SemestersController::class, "showCreateView"])->name('admin.semesters.create');
            Route::post('semesters/create', [App\Http\Controllers\Admin\SemestersController::class, "create"]);
            Route::get('semesters/edit/{id}', [App\Http\Controllers\Admin\SemestersController::class, "showUpdateView"])->name('admin.semesters.update');
            Route::post('semesters/edit/{id}', [App\Http\Controllers\Admin\SemestersController::class, "update"]);
            Route::post('semesters/delete', [App\Http\Controllers\Admin\SemestersController::class, "delete"])->name('admin.semesters.delete');






            Route::get('years/academic', [App\Http\Controllers\Admin\AcademicYearsController::class, "academicYears"])->name('admin.academicYears');
            Route::get('years/academic/create', [App\Http\Controllers\Admin\AcademicYearsController::class, "showCreateView"])->name('admin.academicYears.create');
            Route::post('years/academic/create', [App\Http\Controllers\Admin\AcademicYearsController::class, "create"]);
            Route::get('years/academic/edit/{id}', [App\Http\Controllers\Admin\AcademicYearsController::class, "showUpdateView"])->name('admin.academicYears.update');
            Route::post('years/academic/edit/{id}', [App\Http\Controllers\Admin\AcademicYearsController::class, "update"]);
            Route::post('years/academic/delete', [App\Http\Controllers\Admin\AcademicYearsController::class, "delete"])->name('admin.academicYears.delete');







            Route::get('headmasters', [App\Http\Controllers\Admin\HeadmastersController::class, "headmasters"])->name('admin.headmasters');
            Route::get('headmasters/create', [App\Http\Controllers\Admin\HeadmastersController::class, "showCreateView"])->name('admin.headmasters.create');
            Route::post('headmasters/create', [App\Http\Controllers\Admin\HeadmastersController::class, "create"]);
            Route::get('headmasters/edit/{id}', [App\Http\Controllers\Admin\HeadmastersController::class, "showUpdateView"])->name('admin.headmasters.update');
            Route::post('headmasters/edit/{id}', [App\Http\Controllers\Admin\HeadmastersController::class, "update"]);
            Route::post('headmasters/delete', [App\Http\Controllers\Admin\HeadmastersController::class, "delete"])->name('admin.headmasters.delete');
            Route::post('headmasters/edit/{id}/password', [App\Http\Controllers\Admin\HeadmastersController::class, "updatePassword"])->name('admin.headmasters.update.password');
            Route::post('headmasters/edit/{id}/status', [App\Http\Controllers\Admin\HeadmastersController::class, "updateAccountStatus"])->name('admin.headmasters.update.status');






            Route::get('guidanceCounselors', [App\Http\Controllers\Admin\GuidanceCounselorsController::class, "guidanceCounselors"])->name('admin.guidanceCounselors');
            Route::get('guidanceCounselors/create', [App\Http\Controllers\Admin\GuidanceCounselorsController::class, "showCreateView"])->name('admin.guidanceCounselors.create');
            Route::post('guidanceCounselors/create', [App\Http\Controllers\Admin\GuidanceCounselorsController::class, "create"]);
            Route::get('guidanceCounselors/edit/{id}', [App\Http\Controllers\Admin\GuidanceCounselorsController::class, "showUpdateView"])->name('admin.guidanceCounselors.update');
            Route::post('guidanceCounselors/edit/{id}', [App\Http\Controllers\Admin\GuidanceCounselorsController::class, "update"]);
            Route::post('guidanceCounselors/delete', [App\Http\Controllers\Admin\GuidanceCounselorsController::class, "delete"])->name('admin.guidanceCounselors.delete');
            Route::post('guidanceCounselors/edit/{id}/password', [App\Http\Controllers\Admin\GuidanceCounselorsController::class, "updatePassword"])->name('admin.guidanceCounselors.update.password');
            Route::post('guidanceCounselors/edit/{id}/status', [App\Http\Controllers\Admin\GuidanceCounselorsController::class, "updateAccountStatus"])->name('admin.guidanceCounselors.update.status');



            Route::group(['middleware' => ['can:manageAny,App\Models\StudyMaterial']], function () {
                Route::get('studyMaterials', [App\Http\Controllers\Admin\StudyMaterialsController::class, "studyMaterials"])->name('admin.studyMaterials');
                Route::get('studyMaterials/create', [App\Http\Controllers\Admin\StudyMaterialsController::class, "showCreateView"])->name('admin.studyMaterials.create');
                Route::post('studyMaterials/create', [App\Http\Controllers\Admin\StudyMaterialsController::class, "create"]);
                Route::get('studyMaterials/edit/{id}', [App\Http\Controllers\Admin\StudyMaterialsController::class, "showUpdateView"])->name('admin.studyMaterials.update');
                Route::post('studyMaterials/edit/{id}', [App\Http\Controllers\Admin\StudyMaterialsController::class, "update"]);
                Route::post('studyMaterials/delete', [App\Http\Controllers\Admin\StudyMaterialsController::class, "delete"])->name('admin.studyMaterials.delete');
                Route::get('studyMaterials/{studyMaterialId}/examForms', [App\Http\Controllers\Admin\StudyMaterialsController::class, "examForms"])->name('admin.studyMaterials.examForms');
                Route::post('studyMaterials/{studyMaterialId}/examForms/add', [App\Http\Controllers\Admin\StudyMaterialsController::class, "addExamForms"])->name('admin.studyMaterials.examForms.add');
                Route::post('studyMaterials/examForms/delete', [App\Http\Controllers\Admin\StudyMaterialsController::class, "deleteExamForms"])->name('admin.studyMaterials.examForms.delete');
            });


            Route::group(['middleware' => ['can:manageAny,App\Models\Worksheet']], function () {
                Route::get('worksheets', [App\Http\Controllers\Admin\WorksheetsController::class, "worksheets"])->name('admin.worksheets');
                Route::get('worksheets/create', [App\Http\Controllers\Admin\WorksheetsController::class, "showCreateView"])->name('admin.worksheets.create');
                Route::post('worksheets/create', [App\Http\Controllers\Admin\WorksheetsController::class, "create"]);
                Route::get('worksheets/edit/{id}', [App\Http\Controllers\Admin\WorksheetsController::class, "showUpdateView"])->name('admin.worksheets.update');
                Route::post('worksheets/edit/{id}', [App\Http\Controllers\Admin\WorksheetsController::class, "update"]);
                Route::post('worksheets/delete', [App\Http\Controllers\Admin\WorksheetsController::class, "delete"])->name('admin.worksheets.delete');
            });

            Route::group(['middleware' => ['can:manageAny,App\Models\WeeklyProgram']], function () {
                Route::get('weeklyPrograms', [App\Http\Controllers\Admin\WeeklyProgramsController::class, "weeklyPrograms"])->name('admin.weeklyPrograms');
                Route::get('weeklyPrograms/create', [App\Http\Controllers\Admin\WeeklyProgramsController::class, "showCreateView"])->name('admin.weeklyPrograms.create');
                Route::post('weeklyPrograms/create', [App\Http\Controllers\Admin\WeeklyProgramsController::class, "create"]);
                Route::get('weeklyPrograms/edit/{id}', [App\Http\Controllers\Admin\WeeklyProgramsController::class, "showUpdateView"])->name('admin.weeklyPrograms.update');
                Route::post('weeklyPrograms/edit/{id}', [App\Http\Controllers\Admin\WeeklyProgramsController::class, "update"]);
                Route::post('weeklyPrograms/delete', [App\Http\Controllers\Admin\WeeklyProgramsController::class, "delete"])->name('admin.weeklyPrograms.delete');
            });


            Route::group(['middleware' => ['can:manageAny,App\Models\SemesterExam']], function () {
                Route::get('exams', [App\Http\Controllers\Admin\ExamsController::class, "exams"])->name('admin.exams');
                Route::get('exams/create', [App\Http\Controllers\Admin\ExamsController::class, "showCreateView"])->name('admin.exams.create');
                Route::post('exams/create', [App\Http\Controllers\Admin\ExamsController::class, "create"]);
                Route::get('exams/edit/{id}', [App\Http\Controllers\Admin\ExamsController::class, "showUpdateView"])->name('admin.exams.update');
                Route::post('exams/edit/{id}', [App\Http\Controllers\Admin\ExamsController::class, "update"]);
                Route::get('exams/grades/{id}', [App\Http\Controllers\Admin\ExamsController::class, "showGradesView"])->name('admin.exams.grades');
                Route::post('exams/grades/set', [App\Http\Controllers\Admin\ExamsController::class, "setExamGrade"])->name('admin.exams.grades.set');
                Route::post('exams/delete', [App\Http\Controllers\Admin\ExamsController::class, "delete"])->name('admin.exams.delete');

                Route::get('exam/programs', [App\Http\Controllers\Admin\ExamsController::class, "examsPrograms"])->name('admin.exams.programs');
                Route::post('exam/programs/add', [App\Http\Controllers\Admin\ExamsController::class, "addExamProgram"])->name('admin.exams.programs.add');
                Route::post('exam/programs/delete', [App\Http\Controllers\Admin\ExamsController::class, "deleteExamProgram"])->name('admin.exams.programs.delete');

                Route::get('exam/division/levelMaterials', [App\Http\Controllers\Admin\ExamsController::class, "getDivisionLevelMaterials"])->name('admin.division.level.materials');
            });

            Route::group(['middleware' => ['can:manageAny,App\Models\Settings']], function () {
                Route::get('settings', [App\Http\Controllers\Admin\SettingsController::class, "settings"])->name('admin.settings');
                Route::post('settings/update', [App\Http\Controllers\Admin\SettingsController::class, "updateSetting"])->name('admin.settings.update');
            });



            Route::group(['middleware' => ['can:manageAny,App\Models\StudentNote']], function () {
                Route::get('notes', [App\Http\Controllers\Admin\NotesController::class, "notes"])->name('admin.notes');
                // Route::get('notes/create', [App\Http\Controllers\Admin\NotesController::class, "showCreateView"])->name('admin.notes.create');
                Route::post('notes/create', [App\Http\Controllers\Admin\NotesController::class, "create"])->name('admin.notes.create');
                // Route::get('notes/edit/{id}', [App\Http\Controllers\Admin\NotesController::class, "showUpdateView"])->name('admin.notes.update');
                // Route::post('notes/edit/{id}', [App\Http\Controllers\Admin\NotesController::class, "update"]);
                Route::post('notes/delete', [App\Http\Controllers\Admin\NotesController::class, "delete"])->name('admin.notes.delete');
                Route::get('notes-for-multy-students', [App\Http\Controllers\Admin\NotesController::class, "notesForMultyStudents"])->name('admin.notes.notesForMultyStudents');
                Route::post('add-notes-for-multy-students', [App\Http\Controllers\Admin\NotesController::class, "addNotesForMultyStudents"])->name('admin.notes.addNotesForMultyStudents');
            });


            Route::group(['middleware' => ['can:manageAny,App\Models\Announcement']], function () {
                Route::get('announcements', [App\Http\Controllers\Admin\AnnouncementsController::class, "announcements"])->name('admin.announcements');
                Route::get('announcements/create', [App\Http\Controllers\Admin\AnnouncementsController::class, "showCreateView"])->name('admin.announcements.create');
                Route::post('announcements/create', [App\Http\Controllers\Admin\AnnouncementsController::class, "create"])->name('admin.announcements.create');
                Route::get('announcements/edit/{id}', [App\Http\Controllers\Admin\AnnouncementsController::class, "showUpdateView"])->name('admin.announcements.update');
                Route::post('announcements/edit/{id}', [App\Http\Controllers\Admin\AnnouncementsController::class, "update"]);
                Route::post('announcements/delete', [App\Http\Controllers\Admin\AnnouncementsController::class, "delete"])->name('admin.announcements.delete');
            });


            Route::group(['middleware' => ['can:manageAny,App\Models\Transportation']], function () {
                Route::get('transportations', [App\Http\Controllers\Admin\TransportationsController::class, "transportations"])->name('admin.transportations');
                Route::get('transportations/create', [App\Http\Controllers\Admin\TransportationsController::class, "showCreateView"])->name('admin.transportations.create');
                Route::post('transportations/create', [App\Http\Controllers\Admin\TransportationsController::class, "create"])->name('admin.transportations.create');
                Route::get('transportations/edit/{id}', [App\Http\Controllers\Admin\TransportationsController::class, "showUpdateView"])->name('admin.transportations.update');
                Route::post('transportations/edit/{id}', [App\Http\Controllers\Admin\TransportationsController::class, "update"]);
                Route::post('transportations/delete', [App\Http\Controllers\Admin\TransportationsController::class, "delete"])->name('admin.transportations.delete');
            });


            // Route::get('exams', [App\Http\Controllers\Admin\ExamsController::class, "exams"])->name('admin.exams');
            // Route::get('notes', [App\Http\Controllers\Admin\NotesController::class, "notes"])->name('admin.notes');
            // Route::get('announcements', [App\Http\Controllers\Admin\AnnouncementsController::class, "announcements"])->name('admin.announcements');
            // Route::get('buses', [App\Http\Controllers\Admin\BusesController::class, "buses"])->name('admin.buses');
            // Route::get('drivers', [App\Http\Controllers\Admin\DriversController::class, "drivers"])->name('admin.drivers');
            // Route::get('transportations', [App\Http\Controllers\Admin\TransportationsController::class, "transportations"])->name('admin.transportations');

            Route::get('/', function () {
                return view('admin.home');
            })->name('admin.home');
        });
    });
});


Route::get('/Sum',function(){
    $result[] = DB::table('student_exam_grades')
    ->select(DB::raw('SUM(student_exam_grades.grad) as grade,semester_exams.quiz_type as quize_type'))
    ->join('semester_exams','semester_exams.id','=','student_exam_grades.semester_exam_id')
    ->where('student_exam_grades.student_id',311);
    

   
    return $result;
});


Route::get('queue-run', function () {
    \Illuminate\Support\Facades\Artisan::call('queue:work', [
        '--timeout' => '20',
        '--max-time' => Settings::queueMaxProssingTime()
    ]);
    return 0;
});
