app/Api/V1/Traits/HasComments.php
/**
     * function to save comment related to the particular model
     */
function to save comment related to the particular model
function to save comment related to the particular model
public function saveComment($request)
    {
        if ($body = $request->get('comment')) {
            $comment = new Comment();
            $comment->body = $body;
            $this->comments()->save($comment);
        }
        return;
    }
public function saveComment ( $ request ) { if ( $ body = $ request -> get ( 'comment' ) ) { $ comment = new Comment ( ) ; $ comment -> body = $ body ; $ this -> comments ( ) -> save ( $ comment ) ; } return ; }
function to save comment related to the particular model
function to save comment related to the particular model