Forms_Laravel/routes/web.php

33 lines
1.5 KiB
PHP

<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\FormController;
use App\Http\Controllers\ResponseController;
use App\Http\Controllers\QuestionController;
use Illuminate\Support\Facades\Auth;
Route::get('/', function () {
return view('welcome');
});
Auth::routes();
// Form routes
Route::middleware(['auth'])->group(function () {
Route::get('/forms', [FormController::class, 'index'])->name('forms.index');
Route::get('/forms/create', [FormController::class, 'create'])->name('forms.create');
Route::post('/forms', [FormController::class, 'store'])->name('forms.store');
Route::get('/forms/{form}', [FormController::class, 'show'])->name('forms.show');
Route::get('/forms/{form}/edit', [FormController::class, 'edit'])->name('forms.edit');
Route::put('/forms/{form}', [FormController::class, 'update'])->name('forms.update');
Route::delete('/forms/{form}', [FormController::class, 'destroy'])->name('forms.destroy');
});
// Response routes
Route::middleware(['auth'])->group(function () {
Route::get('/forms/respond/{form}', [ResponseController::class, 'showForm'])->name('responses.showForm');
Route::post('/forms/respond/{form}', [ResponseController::class, 'submitForm'])->name('responses.submitForm');
Route::get('/forms/{form}/responses', [ResponseController::class, 'viewResponses'])->name('responses.viewResponses');
Route::get('/forms/{form}/responses/{responseId}', [ResponseController::class, 'viewResponse'])->name('responses.viewResponse');
});