app/Http/Controllers/RemarkController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\remark  $remark
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request,  $remarkid)
    {
        $validator=Validator::make($request->all(),[
            'updateRemark'=>'required|string',
        ]);
        if ($validator->fails()){
            return response()->json(['errors'=>$validator->errors()->first()]);
        }
        $remark=remark::find($remarkid);
        $remark->update([
            'body'=>$request->updateRemark,
            'user_id'=>auth()->user()->id
        ]);
        return response()->json(['success'=>$remark->body],200);
    }
public function update ( Request $ request , $ remarkid ) { $ validator = Validator :: make ( $ request -> all ( ) , [ 'updateRemark' => 'required|string' , ] ) ; if ( $ validator -> fails ( ) ) { return response ( ) -> json ( [ 'errors' => $ validator -> errors ( ) -> first ( ) ] ) ; } $ remark = remark :: find ( $ remarkid ) ; $ remark -> update ( [ 'body' => $ request -> updateRemark , 'user_id' => auth ( ) -> user ( ) -> id ] ) ; return response ( ) -> json ( [ 'success' => $ remark -> body ] , 200 ) ; }
Update the specified resource in storage.
Update the specified resource in storage .