We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ed4baef commit a929d0aCopy full SHA for a929d0a
1 file changed
src/Models/BaseModel.php
@@ -78,7 +78,8 @@ public static function table(): string
78
$className = (new \ReflectionClass(static::class))->getShortName();
79
80
// Convert PascalCase to snake_case (no pluralization)
81
- $tableName = strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $className));
+ // Must match ModelScanner::classNameToTableName() to avoid table name mismatches
82
+ $tableName = strtolower((string) preg_replace('/([A-Z])/', '_$1', lcfirst($className)));
83
84
return $tableName;
85
}
0 commit comments