<?php namespace Config;

use CodeIgniter\Hooks\Hooks;
use Pratik\Controllers\Login;

/*
 * --------------------------------------------------------------------
 * Application Hooks
 * --------------------------------------------------------------------
 * Hooks allow you to tap into the execution of the program without
 * modifying or extending core files. This file provides a central
 * location to define your hooks, though they can always be added
 * at run-time, also, if needed.
 *
 * You create code that can execute by subscribing to events with
 * the 'on()' method. This accepts any form of callable, including
 * Closures, that will be executed when the hook is triggered.
 *
 * Example:
 *      Hooks::on('create', [$myInstance, 'myMethod']);
 */



/*
 * --------------------------------------------------------------------
 * Debug Toolbar Listeners.
 * --------------------------------------------------------------------
 * If you delete, they will no longer be collected.
 */
if (ENVIRONMENT != 'production')
{
	Hooks::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect');
}
$login = new Login();
Hooks::on('post_controller_constructor', [$login,'checkLogin']);



