@dabbash what would show more quizzes do?
BTW in your controller, to match CRUD actions, your method to display all quizzes should be called
index()
and then the method to display one quiz would be called
show($slug)
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi everyone,
I build a simple quiz app, and I prepared the route and the controller
this is web.php:
Route::get('/trivia/{slug}', 'Web\TriviaQuizController@index')->name('trivia-quiz');
This is TriviaQuizController were to view the quiz questions :
class TriviaQuizController extends Controller
{
public function home(){
$quizzes = Quiz::where('quiz_type', 'trivia')->latest()->get();
return view('web.trivia-home', compact('quizzes'));
}
public function index($slug)
{
$quiz = Quiz::where('slug', $slug)->first();
if($quiz){
$questions = Question::where('quiz_id', $quiz->id)->with('media.children', 'trivia_answers.media.children')->get();
}else{
abort(404);
}
return view('web.quiz.trivia-quiz', compact('questions', 'quiz'));
}
}
If I have to include an additional function in the same view that supports to get like "show more quizzes"
How I can do that?
Please or to participate in this conversation.