<?php

class LComment {

    public static function update($id, $data)
    {

        $update = Comment::where('id', $id)->update($data);

        if ($update) {
            $response = [
                'status'  => true,
                'message' => 'Update successfuly'
            ];
        } else {
            $response = [
                'status'  => false,
                'message' => 'An error Occured'
            ];
        }

        return $response;
    }

    public static function remove($id)
    {
        $comment = Comment::find($id);
        $comment->status = -1;

        if ($comment->save()) {
            return [
                'status'    => true,
                'message' => 'Remove successfuly'
            ];
        }

        return [
            'status' => false,
            'errors' => 'Error an Ocurred'
        ];
    }


    public static function get($id)
    {
        $contact = Comment::where('id', $id)->where('status', '!=', -1)->firstOrFail();;
        return $contact;
    }

}