<?php namespace App\Controllers\Administrativo;

 use App\Models\Administrativo\CategoriaModel;
 use CodeIgniter\Controller;
 use App\Libraries\Auth;
 
 class Cad_Categoria extends Controller
 {

	public function __construct(){
        $this->session = \Config\Services::session();
        $this->usuario = $this->session->get('dadoslogin');
        if($this->usuario == null){
            return redirect()->to('/Login');
        }
        $this->categoriaModel = new CategoriaModel();
        $this->auth = new Auth();
        helper('complementos'); 
	}

	public function index(){
        if($this->auth->CheckAuth(7)){
        $dados['resultados'] = $this->categoriaModel->getCategoria();
        echo view('Commons/header');	
        echo view('Commons/navbartop');
        echo view('Commons/navbarleft', getBarMenu($this->usuario));
        echo view('Administrativo/Categoria/categoria', $dados);
        echo view('Commons/footer');
        }else{
            return redirect()->to('/Acesso');

        }
	}

   


}
