In C# I can create static class that have inside a couple of static classes that I can use as namespaces for constants, for example:
public static class ConstantTypes{
public static class ErrorTypes{
public static string Log = "Log";
}
}
Than in app I can use:
ConstantTypes.ErrorTypes.Log
How to do the same in PHP in Laravel?
Now I created two classes:
class LogTypeConstants
{
const MYCONST = 'val';
}
use App\Common\LogTypeConstants;
class AppConstants
{
static function LogTypes() {
$logTypeConstants = new LogTypeConstants();
return $logTypeConstants;
}
}
And in Laravel controller I can use:
$logType = AppConstants::LogTypes()::MYCONST;
Is better way to do the same?