Overview
Theroutes/web.php file defines all HTTP routes for the Wecode application. Routes are organized by resource and functionality, with most routes requiring authentication.
Root & Home
| Method | URI | Name | Controller@Method | Description |
|---|---|---|---|---|
| GET | / | - | Closure | Redirects to home route |
| GET | /home/ | home | home_controller@index | User dashboard/home page |
Authentication Routes
See Authentication Routes for detailed authentication documentation.- Login (GET/POST
/login) - Logout (POST
/logout) - Register (GET/POST
/register) - Password Reset (GET/POST
/password/reset,/password/email)
HTML Editor
| Method | URI | Name | Controller@Method | Middleware |
|---|---|---|---|---|
| GET | /htmleditor | htmleditor | html_editor_controller@index | auth |
| POST | /htmleditor/autosave | htmleditor.autosave | html_editor_controller@autosave | auth |
MOSS (Plagiarism Detection)
| Method | URI | Name | Controller@Method | Access |
|---|---|---|---|---|
| GET | /moss/{id?} | moss.index | moss_controller@index | admin, head_instructor |
| POST | /moss/{id} | moss.update | moss_controller@update | admin, head_instructor |
| POST | /moss/detect/{id} | moss.detect | moss_controller@detect | admin, head_instructor |
Assignment ID for MOSS analysis
Classes (Lops)
| Method | URI | Name | Controller@Method |
|---|---|---|---|
| GET | /lops | lops.index | lop_controller@index |
| GET | /lops/create | lops.create | lop_controller@create |
| POST | /lops | lops.store | lop_controller@store |
| GET | /lops/{lop} | lops.show | lop_controller@show |
| GET | /lops/{lop}/edit | lops.edit | lop_controller@edit |
| PUT/PATCH | /lops/{lop} | lops.update | lop_controller@update |
| DELETE | /lops/{lop} | lops.destroy | lop_controller@destroy |
| POST | /lops/{lop}/enrol/{in} | lops.enrol | lop_controller@enrol |
| GET | /lop/scoreboard/{lop} | lop.scoreboard | lop_controller@scoreboard |
Class (lop) ID
Enrollment action parameter
Settings
| Method | URI | Name | Controller@Method | Access |
|---|---|---|---|---|
| GET | /settings | settings.index | setting_controller@index | admin |
| POST | /settings | settings.update | setting_controller@update | admin |
Users
Custom User Routes
| Method | URI | Name | Controller@Method | Access |
|---|---|---|---|---|
| GET | /users/add_multiple | - | UserController@add_multiple | admin, head_instructor |
| POST | /users/adds | users.add | UserController@add | admin, head_instructor |
| POST | /users/delete_submissions/{user} | users.delete_submissions | UserController@delete_submissions | admin |
| DELETE | /users/{id} | users.destroy | UserController@destroy | admin |
| GET | /users/ranking | users.rank | UserController@rank | all authenticated |
| GET | /users/set_trial | users.set_trial | View only | auth |
| POST | /users/set_trial | users.set_trial_post | UserController@set_trial | auth |
Resource Routes
| Method | URI | Name | Controller@Method |
|---|---|---|---|
| GET | /users | users.index | UserController@index |
| GET | /users/create | users.create | UserController@create |
| POST | /users | users.store | UserController@store |
| GET | /users/{user} | users.show | UserController@show |
| GET | /users/{user}/edit | users.edit | UserController@edit |
| PUT/PATCH | /users/{user} | users.update | UserController@update |
User ID
Problems
Custom Problem Routes
| Method | URI | Name | Controller@Method | Access |
|---|---|---|---|---|
| GET | /problems/downloadtestsdesc/{id} | problems.downloadtestsdesc | problem_controller@downloadtestsdesc | auth |
| GET | /problems/downloadtestcases/{problem}/{assignment}/{type} | problems.download_testcases | problem_controller@download_testcases | auth |
| GET | /problems/export | problems.export | problem_controller@export | auth |
| POST | /problems/import | problems.import | problem_controller@import | admin, head_instructor |
| POST | /problems/edit_description/{problem} | problems.edit_description | problem_controller@edit_description | admin, head_instructor, instructor |
| POST | /problems/toggle_practice/{query?} | problems.toggle_practice | problem_controller@toggle_practice | owner |
| POST | /problems/edit_tags/{problem?} | problems.edit_tags | problem_controller@edit_tags | owner |
Problem ID
Assignment ID (for permission check)
Download type: “in” or “out”
Format: “practice.” or “sharable.”
Resource Routes
| Method | URI | Name | Controller@Method |
|---|---|---|---|
| GET | /problems | problems.index | problem_controller@index |
| GET | /problems/create | problems.create | problem_controller@create |
| POST | /problems | problems.store | problem_controller@store |
| GET | /problems/{problem} | problems.show | problem_controller@show |
| GET | /problems/{problem}/edit | problems.edit | problem_controller@edit |
| PUT/PATCH | /problems/{problem} | problems.update | problem_controller@update |
| DELETE | /problems/{problem} | problems.destroy | problem_controller@destroy |
problems.show always aborts with 404. Problems must be viewed through assignments or practice.
Submissions
| Method | URI | Name | Controller@Method | Access |
|---|---|---|---|---|
| GET | /submissions/assignment/{assignment_id}/user/{user_id}/problem/{problem_id}/view/{choose} | submissions.index | submission_controller@index | auth |
| GET | /submissions/create/assignment/{assignment}/problem/{problem}/{oldsub?} | submissions.create | submission_controller@create | auth |
| POST | /submissions/store/ | submissions.store | submission_controller@store | auth |
| POST | /submissions/get_template/ | submissions.get_template | submission_controller@get_template | auth |
| POST | /submissions/rejudge/ | submissions.rejudge | submission_controller@rejudge | not student |
| POST | /submissions/view_code/ | submissions.view_code | submission_controller@view_code | auth |
| POST | /submissions/view_status/ | submissions.view_status | submission_controller@view_status | auth |
| POST | /submissions/select/ | submissions.select | submission_controller@select_final | auth |
| GET | /rejudge/{assignment} | submissions.rejudge_view | submission_controller@rejudge_view | admin, head_instructor |
| POST | /submissions/rejudge_all_problems_assignment/ | submissions.rejudge_all_problems_assignment | submission_controller@rejudge_all_problems_assignment | admin, head_instructor, instructor |
Assignment ID (use 0 for practice)
User ID or “all” for all users
Problem ID or “all” for all problems
Filter: “all” or “final”
Optional previous submission ID to load
Queue
| Method | URI | Name | Controller@Method | Access |
|---|---|---|---|---|
| GET | /queue | queue.index | queue_controller@index | admin, head_instructor |
| POST | /queue | queue.work | queue_controller@work | admin, head_instructor |
| POST | /queue/{item}/unlock | queue.unlock | queue_controller@unlock | admin, head_instructor |
| POST | /queue/empty | queue.empty | queue_controller@empty | admin, head_instructor |
Queue item ID
Practice
| Method | URI | Name | Controller@Method | Middleware |
|---|---|---|---|---|
| GET | /practice | practice | practice_controller@index | auth |
| GET | /practice/show/{problem} | practices.show | practice_controller@show | auth |
| GET | /practice/show/{problem}/pdf | practices.show_pdf | practice_controller@show_pdf | auth |
Problem ID to view in practice mode
Scoreboard
| Method | URI | Name | Controller@Method | Middleware |
|---|---|---|---|---|
| GET | /scoreboard/full/{id} | scoreboards.index | scoreboard_controller@index | auth |
| GET | /scoreboard/simplify/{id} | scoreboards.simplify | scoreboard_controller@simplify | auth |
| GET | /scoreboard/plain/{id} | scoreboards.plain | scoreboard_controller@plain | auth |
Assignment ID
Assignments
Custom Assignment Routes
| Method | URI | Name | Controller@Method | Access |
|---|---|---|---|---|
| GET | /assignment/{assignment}/{problem_id}/ | assignments.show | assignment_controller@show | auth |
| GET | /assignment/{assignment}/{problem}/pdf | assignments.show_pdf | assignment_controller@show_pdf | auth |
| GET | /assignment/download_submissions/{type}/{assignment_id}/ | assignments.download_submissions | assignment_controller@download_submissions | admin, head_instructor, instructor |
| GET | /assignment/download_all_submissions/{assignment_id}/ | assignments.download_all_submissions | assignment_controller@download_all_submissions | admin, head_instructor, instructor |
| GET | /assignment/reload_scoreboard/{assignment_id}/ | assignments.reload_scoreboard | assignment_controller@reload_scoreboard | admin, head_instructor, instructor |
| GET | /assignment/scores/accepted/ | assignments.score_accepted | assignment_controller@score_accepted | admin, head_instructor, instructor |
| GET | /assignment/scores/sum/ | assignments.score_sum | assignment_controller@score_sum | admin, head_instructor, instructor |
| POST | /assignment/check_open/ | assignments.check_open | assignment_controller@check_open | owner |
| GET | /assignment/duplicate/{assignment} | assignments.duplicate | assignment_controller@duplicate | owner |
Assignment ID
Problem ID within assignment
Download organization: “by_user” or “by_problem”
Resource Routes
| Method | URI | Name | Controller@Method |
|---|---|---|---|
| GET | /assignments | assignments.index | assignment_controller@index |
| GET | /assignments/create | assignments.create | assignment_controller@create |
| POST | /assignments | assignments.store | assignment_controller@store |
| GET | /assignments/{assignment}/edit | assignments.edit | assignment_controller@edit |
| PUT/PATCH | /assignments/{assignment} | assignments.update | assignment_controller@update |
| DELETE | /assignments/{assignment} | assignments.destroy | assignment_controller@destroy |
assignments.show is excluded from resource routes in favor of custom show route.
Notifications
| Method | URI | Name | Controller@Method |
|---|---|---|---|
| GET | /notifications | notifications.index | notification_controller@index |
| GET | /notifications/create | notifications.create | notification_controller@create |
| POST | /notifications | notifications.store | notification_controller@store |
| GET | /notifications/{notification} | notifications.show | notification_controller@show |
| GET | /notifications/{notification}/edit | notifications.edit | notification_controller@edit |
| PUT/PATCH | /notifications/{notification} | notifications.update | notification_controller@update |
| DELETE | /notifications/{notification} | notifications.destroy | notification_controller@destroy |
Languages
| Method | URI | Name | Controller@Method |
|---|---|---|---|
| GET | /languages | languages.index | language_controller@index |
| GET | /languages/create | languages.create | language_controller@create |
| POST | /languages | languages.store | language_controller@store |
| GET | /languages/{language} | languages.show | language_controller@show |
| GET | /languages/{language}/edit | languages.edit | language_controller@edit |
| PUT/PATCH | /languages/{language} | languages.update | language_controller@update |
| DELETE | /languages/{language} | languages.destroy | language_controller@destroy |
Tags
| Method | URI | Name | Controller@Method |
|---|---|---|---|
| GET | /tags | tags.index | tag_controller@index |
| GET | /tags/create | tags.create | tag_controller@create |
| POST | /tags | tags.store | tag_controller@store |
| GET | /tags/{tag} | tags.show | tag_controller@show |
| GET | /tags/{tag}/edit | tags.edit | tag_controller@edit |
| PUT/PATCH | /tags/{tag} | tags.update | tag_controller@update |
| DELETE | /tags/{tag} | tags.destroy | tag_controller@destroy |
Utility Routes
Server Time
| Method | URI | Description |
|---|---|---|
| GET | /server_time | Returns current server time in ISO 8601 format |
Route Ordering Notes
From the source code comments:/users/ranking must come before the resource routes or it would be interpreted as /users/{user} with user = "ranking".
Middleware
Global Middleware
All routes inweb.php receive:
webmiddleware group- Session handling
- CSRF protection
- Cookie encryption
Route-Specific Middleware
auth- Requires authenticated user
- Redirects to login if unauthenticated
- Applied to most routes
- Requires unauthenticated user
- Applied to login/register routes
- Redirects authenticated users to home
- Checks IP against whitelist
- Applied in controller constructors
- Used for secure operations
- Prevents write operations in archive mode
- Applied in controller constructors
- Used for data preservation
Resource Routes Explained
Laravel’sRoute::resource() generates standard CRUD routes:
GET /users→ indexGET /users/create→ createPOST /users→ storeGET /users/{user}→ showGET /users/{user}/edit→ editPUT/PATCH /users/{user}→ updateDELETE /users/{user}→ destroy
->except(['show'])- Exclude specific actions->only(['index', 'show'])- Include only specific actions
Named Routes
Most routes have names for easy URL generation:Route Parameters
Model Binding
Route parameters are automatically bound to models:Custom Constraints
Some routes use regex constraints:Route Groups
While not explicitly shown in the file, routes can be organized into groups:API Routes
Note: Wecode does not define separate API routes inroutes/api.php. All routes are web routes with session-based authentication.
For AJAX requests, routes accept POST data and return JSON:
submissions.view_codesubmissions.view_statussubmissions.rejudgeproblems.edit_tags
Related Files
routes/api.php- API routes (not used in Wecode)routes/console.php- Artisan commandsroutes/channels.php- Broadcast channelsapp/Http/Kernel.php- Middleware definitions

