<?php namespace App\Controllers;

use App\Controllers\BaseController;
use App\Libraries\Make_bread;
use App\Models\ClientsModel;
use http\Url;

class Clients extends BaseController
{

    /*
     * Clients
     */
	public function index()
	{
        $session = session();
        if(!session()->get('isLoggedIn')){
            return  redirect()->to(base_url().'/auth');
        }
        //$this->init();
        // first load the library breadcrumb
        $make_bread = new Make_bread;
        $data=[
            'heading' =>'Clients',
        ];
        $make_bread->add('Clients', 'clients', TRUE);
        $breadcrumb = $make_bread->output();
        $data['breadcrumb'] =$breadcrumb;

        $db =  db_connect();
        $clients = new  ClientsModel($db);
        $currentEmpresaId = session()->get('empresa_id_user');
        $data['clients'] = $clients->getAll($currentEmpresaId);
		return view('admin/app/clients', $data);
	}

}