Convert model name from PascalCase to snake_case (table name).
This commit is contained in:
parent
f9b2c678f7
commit
27b5ed6015
@ -287,7 +287,14 @@ class Model {
|
|||||||
*/
|
*/
|
||||||
public static function className(): string
|
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
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user