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

Now that we show results after quiz was taken, let's show results for a user from all their taken quizzes.

my results page

First, we'll add a new method to the ResultController.


class ResultController extends Controller
public function index(): View
$results = Test::with('quiz')->withCount('questions')->where('user_id', auth()->id())->paginate();
return view('front.results.index', $results);
// ...

Add the route.


// ...
Route::middleware('auth')->group(function () {
Route::get('results', [ResultController::class, 'index'])->name('results.index');
// ...
// ...

Of course, we need to add link to the navigation. But it needs to be wrapped in @auth directive...

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

You also get:

  • 59 courses (1057 lessons, 42 h 44 min total)
  • Premium tutorials
  • Access to repositories
  • Private Discord