Welcome Guest, Not a member yet? Register   Sign In
Class not found error with events
#4

It is PHP's specification.

When you use namespacing, the classname is  \App\Events\Load_config.
When you specify the classname in a string, you can also write App\Events\Load_config.
If you write Load_config in a string, it means \Load_config and it is the different namespace.

If you use an IDE like PhpStorm and ::class constant, you can write it as \App\Events\Load_config::class,
and IDE can auto complete the classname.

Code:
Events::on('post_controller_constructor', [\App\Events\Load_config::class, 'load_config']); 
Reply


Messages In This Thread
RE: Class not found error with events - by kenjis - 11-18-2022, 05:09 AM
RE: Class not found error with events - by kenjis - 11-20-2022, 02:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB