app/Http/Controllers/PostCommentController.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)
    {
        $comment=PostComment::find($id);
        if($comment){
            $data=$request->all();
            $status=$comment->fill($data)->update();
            if($status){
                request()->session()->flash('success','Comment successfully updated');
            }
            else{
                request()->session()->flash('error','Something went wrong! Please try again!!');
            }
            return redirect()->route('comment.index');
        }
        else{
            request()->session()->flash('error','Comment not found');
            return redirect()->back();
        }
    }
public function update ( Request $ request , $ id ) { $ comment = PostComment :: find ( $ id ) ; if ( $ comment ) { $ data = $ request -> all ( ) ; $ status = $ comment -> fill ( $ data ) -> update ( ) ; if ( $ status ) { request ( ) -> session ( ) -> flash ( 'success' , 'Comment successfully updated' ) ; } else { request ( ) -> session ( ) -> flash ( 'error' , 'Something went wrong! Please try again!!' ) ; } return redirect ( ) -> route ( 'comment.index' ) ; } else { request ( ) -> session ( ) -> flash ( 'error' , 'Comment not found' ) ; return redirect ( ) -> back ( ) ; } }
Update the specified resource in storage.
Update the specified resource in storage .
// return $data;