app/Http/Controllers/FormController.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)
    {
        $form = $request->isMethod('put') ? Form::findOrFail($request->formId) : new Form;
        $form->id = $request->input('formId');
        $form->title = $request->input('title');
        if ($form->save()) {
            return new FormResource($form);
        }
    }
public function store ( Request $ request ) { $ form = $ request -> isMethod ( 'put' ) ? Form :: findOrFail ( $ request -> formId ) : new Form ; $ form -> id = $ request -> input ( 'formId' ) ; $ form -> title = $ request -> input ( 'title' ) ; if ( $ form -> save ( ) ) { return new FormResource ( $ form ) ; } }
Store a newly created resource in storage.
Store a newly created resource in storage .