Laravel: adding a class to global.php -
I would like to register some event listeners in my Larewell project. To do this, I started my When I execute that event, I get an error message Is not it possible to add a class to Try to use it (): Use Note that namespace names (namespace separators with fully named namespace names such as fu \ times, which are not contrary to global names, such as Fubar), major backslash Unnecessary and not allowed because import names are fully qualified, and are not processed relative to existing namespaces. start \ global. Php added the following to the bottom of the file:
Use UserLog; $ UserLog = New UserLog; Event :: Listen ('sentinel.user.login', function () {$ logData = array ('eventDescription' = & gt; "user login."); $ UserLog- & gt; submitLog ($ logData);}) ;
Uses a statement with the non-compound name 'userlog' which has no effect < / Code>
Use user should drag into class
model \ UserLog.php . It works in my other files, but not in the global .php I thought it was because the classes were not automatically loaded, but the code runs after code
ClassLoader
\ UserLog;
Comments
Post a Comment