Skip to main content

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...

The Full Lesson is Only for Premium Members

Want to access all of our courses? (30 h 09 min)

You also get:

55 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

No comments yet…

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.