Hello, I have basic security plugin but i cant start him. Where Im wrong ?!
use Phalcon\Mvc\User\Plugin;
use Phalcon\Events\Event;
use Phalcon\Mvc\Dispatcher;
class Security extends Plugin
{
public function beforeDispatch(Event $event, Dispatcher $dispatcher)
{
print_r('hello');exit;
if ($dispatcher->getControllerName() != 'index' && empty($this->session->get('auth'))) {
$this->session->destroy();
return $this->response->redirect(\Modules\Admin\Models\Enom\IndexEnom::INDEX_URL);
}
}
}