O'Reilly logo

Laravel Application Development Blueprints by Halil İbrahim Yılmaz, Arda Kılıçdağı

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating our questions page

In the details page, we need to show the full question to the user. Also there will be a place for the answers. To create our question page, we perform the following steps:

  1. First, we need to add the details method what we've defined on our route earlier. Add the following code to your QuesionsController.php file under app/controllers:
    /** * Details page **/ public function getDetails($id,$title) { //First, let's try to find the question: $question = Question::with('users','tags')->find($id); if($question) { //We should increase the "viewed" amount $question->update(array( 'viewed' => $question->viewed+1 )); return View::make('qa.details') ->with('title',$question->title) ->with('question',$question); } else { return Redirect::route('index') ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required