/** * Store a newly created resource in storage. * * @return Response */ public function scoreCalcul() { $user = \Auth::user(); $fiche_id_2 = Session::get('fiche_id_2'); $input = Request::all(); $questions = \App\Fiche::find($fiche_id_2)->question; $score = 0; $lol = array_shift($input); $input = array_values($input); $reponse = []; foreach ($questions as $question) { array_push($reponse, $question->reponse); } $test = array_intersect_assoc($input, $reponse); $test = count($test); $reponse = count($reponse); return view('backStudent.resultat', compact('reponse', 'test', 'fiche_id_2', 'user', 'questions')); }