<?php

namespace App\Controllers\Panel\Utils;

use App\Controllers\Panel\BC;
use App\Models\Panel\Utils\SidebarModel;
use CodeIgniter\API\ResponseTrait;

class Sidebar extends BC
{
    use ResponseTrait;
    public function index()
    {
        if (!$this->request->isAJAX() && ENVIRONMENT != 'development') {
            exit('No direct script access allowed');
        }
        $SidebarModel = new SidebarModel();
        $sidebar['appname'] = options('appname');
        $sidebar['dashboard_url'] = dashboard_url();
        $sidebar['favicon'] =  favicon();
        $sidebar['menu'] = $SidebarModel->menu();
        return $this->respond($sidebar);
    }
}
