Skip to content

Commit

Permalink
Merge pull request #125 from nova-horizons/singular-model-names
Browse files Browse the repository at this point in the history
Convert new table names to singular for model names
  • Loading branch information
pb30 committed Apr 22, 2024
2 parents 6bbd646 + cef41ef commit 73b29bb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/RealoquentHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static function validateDirectory(string $directory): void

public static function buildModelName(string $modelNamespace, string $tableName): string
{
return $modelNamespace.ucfirst(Str::studly($tableName));
return $modelNamespace.ucfirst(Str::studly(Str::singular($tableName)));
}

public static function newId(): string
Expand Down
2 changes: 1 addition & 1 deletion src/Writer/ModelWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ protected function buildBaseModel(): string
}
}
$class->addProperty('incrementing', $this->table->incrementing ?? false)->setPublic()->addComment('@var bool');
$class->addProperty('fillable', $this->table->getFillableColumns())->setProtected()->addComment('@var array<int, string>');
$class->addProperty('fillable', $this->table->getFillableColumns())->setProtected()->addComment('@var list<string>');
$class->addProperty('guarded', $this->table->getGuardedColumns())->setProtected()->addComment('@var array<int, string>');
$class->addProperty('casts', $this->table->getCastColumns())->setProtected()->addComment('@var array<string, string>');

Expand Down

0 comments on commit 73b29bb

Please sign in to comment.