<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\CategoryController;
use App\Http\Controllers\QuizQuestionController;



/*
|--------------------------------------------------------------------------
| 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!
|
*/
Route::get('/privacypolicy', [HomeController::class, 'privacypolicy'])->name('privacypolicy');
Route::get('/cookiepolicy', [HomeController::class, 'cookiepolicy'])->name('cookiepolicy');

Auth::routes();

Route::group(['middleware' => ['auth']], function()
{
   Route::get('/', [HomeController::class, 'index'])->name('dashboard');

   //Category Routes
   Route::resource('/category',CategoryController::class);

   //Question Routes
   Route::resource('/question',QuizQuestionController::class);
   Route::get('/uploadcsv', [QuizQuestionController::class,'uploadcsv'])->name('question.uploadcsv');
   Route::post('/importcsv', [QuizQuestionController::class,'importcsv'])->name('question.importcsv');


   Route::get('/quiz/{id}/edit', [QuizQuestionController::class,'edit'])->name('quiz.edit');
   Route::put('/quiz/{id}', [QuizQuestionController::class,'update'])->name('quiz.update');
});
