Skip to content

The Hooks feature does not work #248

Description

@jk1860

I wrote the Hooks::on() function in the application/Config/Hooks.php file , and I trigger the Hooks In the Home controller file(application/Controllers/Home.php) , but the hook does not work.

here is my code in the application/Config/Hooks.php file
Hooks::on('myhook',function(){ echo 'hello this is Hooks'; });

here is my code in the application/Controllers/Home.php file

public function index() { \CodeIgniter\Hooks\Hooks::trigger('myhook'); return view('welcome_message'); }
is there anything wrong with my way of using hooks or should I load the application/Config/Hooks.php file first somewhere?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions