/**
  * Show the application welcome screen to the user.
  *
  * @return Response
  */
 public function index()
 {
     $baseTopicName = "google-analytics";
     $baseTopic = BaseTopic::where('name', '=', $baseTopicName)->first();
     $topics = $baseTopic->topics()->orderBy('name')->get();
     return view('welcome', compact('baseTopic', 'topics'));
 }
Exemple #2
0
 public function show($baseTopicName, $topicName, $questionNumber)
 {
     $baseTopic = BaseTopic::where('name', '=', $baseTopicName)->first();
     $topic = Topic::where('name', '=', $topicName)->first();
     // may needs to be refactored, may check sql queries
     $question = Question::getByTopicAndQuestionNumber($topic, $questionNumber);
     $answers = $question->answers()->get();
     $nextQuestionLink = $question->nextQuestionLink($baseTopicName, $topic, $questionNumber);
     return view('quiz.show')->with(['questionNumber' => $questionNumber, 'topic' => $topic, 'question' => $question, 'answers' => $answers, 'next' => $nextQuestionLink, 'baseTopic' => $baseTopic]);
 }
Exemple #3
0
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $baseTopics = BaseTopic::where('is_published', '=', true)->get();
     $user = \Auth::user();
     return view('home')->with(['baseTopics' => $baseTopics, 'user' => $user]);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     BaseTopic::destroy($id);
     \Session::flash('success', 'Topic is successfully deleted.');
     return redirect('admin/base-topics');
 }