i am new to laravel and i have been following the documentation and several videos but for hours now i have been trying to pass an array from the controller to a view but i keep getting this error in the view:
Undefined variable: quiz
This is the controller code:
public function SetQuestions($id)
{
$query = Quiz::find($id);
$quiz = array(
'id' => $query->id,
'noQuestions' => $query->no_questions,
'totalQuizScore' => $query->total_quiz_score
);
return View::make('quiz.set-questions')->with($quiz);
}
This is the route:
Route::resource("/quiz/set-questions/{id}", 'QuizController@SetQuestions');
This is the code in the view:
<?php var_dump($quiz); ?>
For now i'm just dumping the data to see if the value changes form null.