<?php 

defined('BASEPATH') or exit ('Direct script access not allowed');

require_once APPPATH . "core/My_Admin.php";

class Policy extends My_Admin{

    public function __construct()
    {
        parent::__construct();
    }

    public $table = 'policies';


    // * view policy 
    public function index(){

        $data['details'] = $this->cm->search_single_where(['type' => 'privacy']);

        $this->load->view('admin/includes/header', $data);
        $this->load->view('admin/policy/view');
        $this->load->view('admin/includes/footer');

    }


    // * edit policy
    public function edit(){

        request_method('POST');

        $request = check_parameter([
            'content' => true
        ]);

        $this->cm->update_where($request, ['type' => 'privacy']);

        echo json_encode([
            'status' => '1',
            'message' => 'Privacy Policy updated successfuly.'
        ]);exit;
        
    }

   
    
}
