app/Http/Controllers/Api/V1/NotesController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, $id)
    {
        try{
            $note       = Notes::find($id);
            $note->name = $request->name;
            $note->save();
            return response()->json([new JadwalResource($note),['meta' => [
                'code'      =>200,
                'status'    =>'success',
                'message'   => 'update notes data successfully'   
            ]]]);
        }catch(\Illuminate\Database\QueryException $exception){
            return response()->json(['data'=>null,['meta' => [
                'code'      =>500,
                'status'    =>'failed',
                'message'   => 'update notes data failed'   
            ]]]);
        }
    }
public function update ( Request $ request , $ id ) { try { $ note = Notes :: find ( $ id ) ; $ note -> name = $ request -> name ; $ note -> save ( ) ; return response ( ) -> json ( [ new JadwalResource ( $ note ) , [ 'meta' => [ 'code' => 200 , 'status' => 'success' , 'message' => 'update notes data successfully' ] ] ] ) ; } catch ( \ Illuminate \ Database \ QueryException $ exception ) { return response ( ) -> json ( [ 'data' => null , [ 'meta' => [ 'code' => 500 , 'status' => 'failed' , 'message' => 'update notes data failed' ] ] ] ) ; } }
Update the specified resource in storage.
Update the specified resource in storage .