diff --git a/src/Libs/Model.php b/src/Libs/Model.php index 76565e4..257cf89 100644 --- a/src/Libs/Model.php +++ b/src/Libs/Model.php @@ -287,7 +287,14 @@ class Model { */ public static function className(): string { - return strtolower(substr(strrchr(get_called_class(), '\\'), 1)); + return strtolower( + preg_replace( + '/(?<!^)[A-Z]/', '_$0', + substr( + strrchr(get_called_class(), '\\'), 1 + ) + ) + ); } /**