/**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($id)
 {
     $buscaPerguntas = Pergunta::where('disciplina_id', $id)->orderByRaw('RAND()')->limit(10)->get();
     $perguntas = array();
     foreach ($buscaPerguntas as $bp) {
         for ($i = 0; $i < count($buscaPerguntas); $i++) {
             $array = ['id_pergunta' => $bp->id, 'pergunta' => $bp->pergunta, 'opcoes' => array()];
             $opcoes = [];
             $buscaOpcoes = Opcao::where('pergunta_id', $bp->id)->orderByRaw('RAND()')->get();
             foreach ($buscaOpcoes as $bo) {
                 array_push($array['opcoes'], array('id' => $bo->id, 'opcao' => $bo->opcao));
                 if ($bo->correta == 1) {
                     $array['correta'] = $bo->opcao;
                 }
             }
         }
         array_push($perguntas, $array);
     }
     return view('user.simulado', ['perguntas' => $perguntas, 'disciplina_id' => $id]);
 }