I'm working with a Laravel for a school project and I'm haing osme difficulties solving this problem. The code is exactly what I got from another script and I already double checked the code.
Function Code:
$modules = Module::all();
$id = Auth::user()->id;
$array = array();
foreach($modules as $module) {
$questions = Question::where('m_id', $module['id'])->count();
$answers = Answer::where('m_id', $module['id'])->where('user_id', $id)->where('correct', 1)->count();
$percentage = ($answers / $questions) * 100;
array_push($array, array(
'name' => $module->name,
'description' => $module->description,
'precentage' => $percentage
));
}
print_r($array);
return View::make('hello')->with('modules', $array);
In the print_r($array) function I'm getting exactly everything that I want to get in the view. But the problem is that I don't get anything with me, I'm checking it with {{ Session::has('modules') }} and it returns false (not set).
Any solution to this?