<?php



namespace App\Filters;



use CodeIgniter\HTTP\RequestInterface;

use CodeIgniter\HTTP\ResponseInterface;

use CodeIgniter\Filters\FilterInterface;


class Admin implements FilterInterface {
    public function before(RequestInterface $request, $arguments = null) {
        $role = session('role');
        if($role == null)
            return redirect()->to('user/login'); 
        if( $role == 2){
            return redirect()->to('user/dashboard'); 
        }
    }
    public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) {
    }
}

?>