Courses

Creating a Quiz System with Laravel 10 + Livewire 3: Step-by-Step

In this lesson, we will add a list of taken tests with their results that will only gonna be available for admin users.

tests list page

For that, let's create a controller.

php artisan make:controller Admin/TestController

Add the route.

routes/web.php

// ...
Route::middleware('auth')->group(function () {
// ...
Route::middleware('isAdmin')->group(function () {
Route::get('questions', QuestionList::class)->name('questions');
Route::get('questions/create', QuestionForm::class)->name('questions.create');
Route::get('questions/{question}', QuestionForm::class)->name('questions.edit');
 
Route::get('quizzes', QuizList::class)->name('quizzes');
Route::get('quizzes/create', QuizForm::class)->name('quiz.create');
Route::get('quizzes/{quiz}', QuizForm::class)->name('quiz.edit');
 
Route::get('tests', TestController::class)->name('tests');
});
});
// ...

And the link in the navigation.

resources/views/layouts/navigation.blade.php:

// ...
<x-slot name="content">
<x-dropdown-link :href="route('questions')">
Questions
</x-dropdown-link>
<x-dropdown-link :href="route('quizzes')">
Quizzes
</x-dropdown-link>
<x-dropdown-link :href="route('tests')">
Tests
</x-dropdown-link>
</x-slot>
// ...

Now let's get all tests in the controller...

This lesson is only for Premium Members.
Want to access all lessons of this course?

You also get:

  • 58 courses (1054 lessons, 46 h 42 min total)
  • Premium tutorials
  • Access to repositories
  • Private Discord