src/Http/Controllers/QuestionResourceController.php
public function update(QuestionRequest $request, Question $question)
    { 
        try {
            $request = $request->all();
            $attributes['title'] = $request['title'];
            $attributes['question'] = $request['question'];
            $attributes['category_id'] = $request['category_id'];
            $question->update($attributes);
            
                return redirect('/discussion/'.$request['slug']);
        } catch (Exception $e) {
            return $this->response->message($e->getMessage())
                ->code(400)
                ->status('error')
                ->url(guard_url('forum/question/' . $question->getRouteKey()))
                ->redirect();
        }

    }
public function update(QuestionRequest $request, Question $question)
    { 
        try {
            $request = $request->all();
            $attributes['title'] = $request['title'];
            $attributes['question'] = $request['question'];
            $attributes['category_id'] = $request['category_id'];
            $question->update($attributes);
            
                return redirect('/discussion/'.$request['slug']);
        } catch (Exception $e) {
            return $this->response->message($e->getMessage())
                ->code(400)
                ->status('error')
                ->url(guard_url('forum/question/' . $question->getRouteKey()))
                ->redirect();
        }

    }
public function update ( QuestionRequest $ request , Question $ question ) { try { $ request = $ request -> all ( ) ; $ attributes [ 'title' ] = $ request [ 'title' ] ; $ attributes [ 'question' ] = $ request [ 'question' ] ; $ attributes [ 'category_id' ] = $ request [ 'category_id' ] ; $ question -> update ( $ attributes ) ; return redirect ( '/discussion/' . $ request [ 'slug' ] ) ; } catch ( Exception $ e ) { return $ this -> response -> message ( $ e -> getMessage ( ) ) -> code ( 400 ) -> status ( 'error' ) -> url ( guard_url ( 'forum/question/' . $ question -> getRouteKey ( ) ) ) -> redirect ( ) ; } }
Update the question.

@param Request $request
@param Model   $question

@return Response
Update the question .