<?php
session_start();
require_once "../../check_admin.php";
require_once '../../database.php';


if(!isset($_GET['id']) || $_GET['id']=='')
{
	http_response_code(401);
    echo json_encode(['error_text' => 'Authentication Problem']);
    exit;
}


class deleteAjax extends database
{
    public function deleteData($data, $id)
    {
        return $this->update('tb_subscriptions', $data, ['cl_id' => $id]);
    }
}

$id = $_GET['id'];


$obj = new deleteAjax();
$res = $obj->deleteData(['deleted_at' => date('Y-m-d H:i:s')], $id);

if(!$res)
{
    http_response_code(500);
    echo json_encode(['error_text' => 'Something went wrong']);
    exit;
}

http_response_code(200);
    echo json_encode(['message' => 'Deleted Successfully']);
    exit;