pinsard's avatar

pinsard wrote a reply+100 XP

5mos ago

Target class [env] does not exist.

Years later, this tip is still invaluable, even on Laravel 12.

I inserted an if (app()->isProduction()) inside the config/logging.php file and... bang! Thing is, such an innocent code easily passes uncaught to the sore eyes of an old programmer that is only trying to survive just another day hahaha.

Thanks a lot!

pinsard's avatar

pinsard liked a comment+100 XP

5mos ago

Target class [env] does not exist.

Hey! For someone who will face a similar error you can do the following:

Go to vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel::handle method and put within the catch block

dump($e);die;

In my case there was a parsing error:

result = {ParseError} [7]
 message = "syntax error, unexpected '=>' (T_DOUBLE_ARROW)"
 *Error*string = ""
 code = {int} 0
 file = "/app/config/services.php"
 line = {int} 41
 *Error*trace = {array} [5]
 *Error*previous = null