app/Http/Controllers/QuestionController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $question = $request->isMethod('put') ? Question::findOrFail($request->questionId) : new Question;
        $question->id = $request->input('questionId');
        $question->title = $request->input('title');
        if ($question->save()) {
            return new QuestionResource($question);
        }
    }
public function store ( Request $ request ) { $ question = $ request -> isMethod ( 'put' ) ? Question :: findOrFail ( $ request -> questionId ) : new Question ; $ question -> id = $ request -> input ( 'questionId' ) ; $ question -> title = $ request -> input ( 'title' ) ; if ( $ question -> save ( ) ) { return new QuestionResource ( $ question ) ; } }
Store a newly created resource in storage.
Store a newly created resource in storage .